Versions in this module Expand all Collapse all v0 v0.2.0 Feb 28, 2026 v0.1.3 Feb 27, 2026 v0.1.2 Feb 24, 2026 v0.1.1 Feb 24, 2026 v0.1.0 Feb 24, 2026 Changes in this version + func NewRoleModule(logger logging.Logger, deps *core.Dependencies) core.Module + func SetupRoleRoutes(r chi.Router, h *RoleHandler, jwtMiddleware func(http.Handler) http.Handler) + type CopyRoleRequest struct + Code string + Name string + type CreateRoleInput struct + Code string + DefaultDataScope string + Description string + Name string + ParentID *uuid.UUID + Permissions []string + Sort int + type CreateRoleRequest struct + Code string + DefaultDataScope string + Description string + Name string + ParentID *uuid.UUID + Permissions []string + Sort int + type DeleteRoleDataScopeRuleRequest struct + Domain string + ResourceKey string + type RoleDataScopeRule struct + Domain string + ResourceKey string + ScopeType string + ScopeValue string + type RoleDataScopeRuleInput struct + Domain string + ResourceKey string + ScopeType string + ScopeValue string + type RoleHandler struct + func NewRoleHandler(roleService *RoleService, logger logging.Logger) *RoleHandler + func (h *RoleHandler) CopyRole(w http.ResponseWriter, r *http.Request) + func (h *RoleHandler) CreateRole(w http.ResponseWriter, r *http.Request) + func (h *RoleHandler) DeleteRole(w http.ResponseWriter, r *http.Request) + func (h *RoleHandler) DeleteRoleDataScopeRule(w http.ResponseWriter, r *http.Request) + func (h *RoleHandler) GetRole(w http.ResponseWriter, r *http.Request) + func (h *RoleHandler) GetRoleChildren(w http.ResponseWriter, r *http.Request) + func (h *RoleHandler) GetRoleParents(w http.ResponseWriter, r *http.Request) + func (h *RoleHandler) GetRoleTree(w http.ResponseWriter, r *http.Request) + func (h *RoleHandler) ListRoleDataScopeRules(w http.ResponseWriter, r *http.Request) + func (h *RoleHandler) ListRoleUsers(w http.ResponseWriter, r *http.Request) + func (h *RoleHandler) ListRoles(w http.ResponseWriter, r *http.Request) + func (h *RoleHandler) SetRoleMenus(w http.ResponseWriter, r *http.Request) + func (h *RoleHandler) SetRolePermissions(w http.ResponseWriter, r *http.Request) + func (h *RoleHandler) UpdateRole(w http.ResponseWriter, r *http.Request) + func (h *RoleHandler) UpsertRoleDataScopeRule(w http.ResponseWriter, r *http.Request) + type RoleModule struct + func (m *RoleModule) Name() string + func (m *RoleModule) RegisterPrivateRoutes(r chi.Router) + func (m *RoleModule) RegisterPublicRoutes(r chi.Router) + type RoleService struct + func NewRoleService(client *ent.Client, logger logging.Logger, rbacManager *rbac.RBACManager) *RoleService + func (s *RoleService) CopyRole(ctx context.Context, sourceID uuid.UUID, newName, newCode string) (*ent.Role, error) + func (s *RoleService) CreateRole(ctx context.Context, name, code, description string, sort int, ...) (*ent.Role, error) + func (s *RoleService) CreateRoleV2(ctx context.Context, in CreateRoleInput) (*ent.Role, error) + func (s *RoleService) DeleteRole(ctx context.Context, id uuid.UUID) error + func (s *RoleService) DeleteRoleDataScopeRule(ctx context.Context, roleID uuid.UUID, domain, resourceKey string) error + func (s *RoleService) GetRole(ctx context.Context, id uuid.UUID) (*ent.Role, error) + func (s *RoleService) GetRoleChildren(ctx context.Context, roleID uuid.UUID, recursive bool) ([]*ent.Role, error) + func (s *RoleService) GetRoleParents(ctx context.Context, roleID uuid.UUID) ([]*ent.Role, error) + func (s *RoleService) GetRoleTree(ctx context.Context) ([]*RoleTreeNode, error) + func (s *RoleService) ListRoleDataScopeRules(ctx context.Context, roleID uuid.UUID) ([]RoleDataScopeRule, error) + func (s *RoleService) ListRoleUsers(ctx context.Context, roleID uuid.UUID, page, pageSize int) ([]*ent.User, int, error) + func (s *RoleService) ListRoles(ctx context.Context, page, pageSize int) ([]*ent.Role, int, error) + func (s *RoleService) SetRoleMenus(ctx context.Context, roleID uuid.UUID, menuIDs []uuid.UUID) error + func (s *RoleService) SetRolePermissions(ctx context.Context, roleID uuid.UUID, codes []string) error + func (s *RoleService) UpdateRole(ctx context.Context, id uuid.UUID, name, description string, sort int, ...) (*ent.Role, error) + func (s *RoleService) UpdateRoleV2(ctx context.Context, in UpdateRoleInput) (*ent.Role, error) + func (s *RoleService) UpsertRoleDataScopeRule(ctx context.Context, roleID uuid.UUID, in RoleDataScopeRuleInput) error + type RoleTreeNode struct + Children []*RoleTreeNode + Code string + Description string + ID uuid.UUID + IsSystem bool + Name string + ParentID *uuid.UUID + Sort int + type SetRoleMenusRequest struct + MenuIDs []uuid.UUID + type SetRolePermissionsRequest struct + PermissionCodes []string + type UpdateRoleInput struct + DefaultDataScope *string + Description *string + HasParentID bool + ID uuid.UUID + Name *string + ParentID *uuid.UUID + Sort *int + type UpdateRoleRequest struct + DefaultDataScope *string + Description *string + Name *string + ParentID *uuid.UUID + Sort *int