Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[r/boards] initialize board-level AdminDAO #3346

Open
11 tasks
salmad3 opened this issue Dec 16, 2024 · 0 comments
Open
11 tasks

[r/boards] initialize board-level AdminDAO #3346

salmad3 opened this issue Dec 16, 2024 · 0 comments
Assignees

Comments

@salmad3
Copy link
Member

salmad3 commented Dec 16, 2024

Context:

⚠️ Criteria is a WIP

When creating a new board within the boards realm, an associated AdminDAO must be initialized to manage that specific board. This AdminDAO is responsible for the governance and administration of the individual board, separate from the realm-level AdminDAO. The board-level AdminDAO needs to be designed with appropriate permissions, roles, and functionalities to effectively manage its respective board while integrating with the broader permissions system and realm-level governance.

Acceptance Criteria:

  • Includes a function to initialize a board-level AdminDAO when creating a new board:

    Example
    func CreateBoard(creator Address, boardName string, config BoardConfig) (*Board, error) {
        if err := validateBoardName(boardName); err != nil {
            return nil, fmt.Errorf("invalid board name: %w", err)
        }
    
        board := &Board{
            Name:   boardName,
            Config: config,
        }
        
        adminDAO, err := InitializeBoardAdminDAO(creator, config.InitialAdmins)
        if err != nil {
            return nil, fmt.Errorf("failed to initialize board AdminDAO: %w", err)
        }
        
        board.AdminDAO = adminDAO
        
        // Additional board creation logic...
        
        return board, nil
    }
    
  • Defines the structure for the board-level AdminDAO:

    Example
    type BoardAdminDAO struct {
        Owners     []Address
        Admins     []Address
        Moderators []Address
        Members    []Address
        Config     BoardConfig
    }
    
    type BoardConfig struct {
        IsPublic            bool
        PostingPermissions  PostingPermissionLevel
        VotingSystem        VotingSystem
        ModeratorThreshold  int
    }
    
  • Implements the BoardAdminDAO to satisfy the Permissions interface:

    Example
    func (dao *BoardAdminDAO) WithPermission(user Address, action string, args []interface{}, callback func([]interface{})) error {
        if dao.hasPermission(user, action, args) {
            return callback(args)
        }
        return fmt.Errorf("unauthorized: user does not have permission for this action")
    }
    
    func (dao *BoardAdminDAO) GetRoles() []string {
        return []string{"owner", "admin", "moderator", "member"}
    }
    
    func (dao *BoardAdminDAO) GetUsers(role string) []Address {
        switch role {
        case "owner":
            return dao.Owners
        case "admin":
            return dao.Admins
        case "moderator":
            return dao.Moderators
        case "member":
            return dao.Members
        default:
            return nil
        }
    }
    
  • Includes functions for the board-level AdminDAO to manage board-specific settings:

    • Set board visibility (public/private)
    • Set posting permissions
    • Manage board-specific rules
  • Includes role management functions for the board-level AdminDAO:

    • Add/remove owners (ensuring at least one owner remains)
    • Add/remove admins
    • Add/remove moderators
    • Manage member permissions
  • Ensures the board-level AdminDAO can interact with the board's content:

    • Pin/unpin posts
    • Remove posts or comments
    • Ban users from the board
  • Includes a function for the board-level AdminDAO to set board-wide notifications

  • Includes a mechanism for the realm-level AdminDAO to interact with board-level AdminDAOs when necessary (e.g., in cases of policy violations):

    Example
    func (realmAdminDAO *RealmAdminDAO) FreezeBoard(boardName string) error {
        board := GetBoardByName(boardName)
        if board == nil {
            return fmt.Errorf("board not found: %s", boardName)
        }
        return board.AdminDAO.Freeze(realmAdminDAO.Address)
    }
    
    func (boardAdminDAO *BoardAdminDAO) Freeze(realmAdminAddress Address) error {
        if !boardAdminDAO.isRealmAdmin(realmAdminAddress) {
            return fmt.Errorf("unauthorized: only realm admin can freeze board")
        }
        boardAdminDAO.Config.IsFrozen = true
        return nil
    }
    
  • Implements a way for the board creator to transfer ownership or dissolve the board if needed

  • Interacts with flagging system:

    Example
    func (board *Board) FlagPost(user Address, postID int, reason string) error {
        if !board.AdminDAO.IsModerator(user) {
            return fmt.Errorf("unauthorized: only moderators can flag posts")
        }
        post := board.GetPost(postID)
        if post == nil {
            return fmt.Errorf("post not found: %d", postID)
        }
        post.AddFlag(Flag{User: user, Reason: reason})
        if post.FlagCount() >= board.Config.ModeratorThreshold {
            post.Hide()
        }
        return nil
    }
    
  • Unit tests to verify the functionality of the board-level AdminDAO, including:

    • Admin management
    • Permission checks
    • Board-specific configurations
    • Interaction with the realm-level AdminDAO

Notes:

  • For the MVP, implement a simple system without proposals for most actions.
  • Ensure that the board-level AdminDAO has limited scope and cannot affect other boards or the realm-level settings.
  • The relationship between the realm-level AdminDAO and board-level AdminDAOs should be clearly defined, especially for cases where intervention might be necessary.
  • The board-level AdminDAO should implement necessary interfaces (e.g., Permissions, MemberDirectory).
  • Consider the upgrade process for individual boards and how it relates to the realm-level upgrade process in future iterations.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Triage
Development

No branches or pull requests

2 participants