Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type RBACService ¶
type RBACService struct {
// contains filtered or unexported fields
}
Service handles permission checks with set-based lookups
func NewRBACService ¶
func NewRBACService(cfg *config.Configuration) (*RBACService, error)
NewRBACService loads roles.json from config and optimizes for fast lookups
func (*RBACService) GetRole ¶
func (s *RBACService) GetRole(roleID string) (*Role, bool)
GetRole returns a specific role with metadata
func (*RBACService) HasPermission ¶
func (s *RBACService) HasPermission(roles []string, entity string, action string) bool
HasPermission checks if any of the user's roles grant permission Complexity: O(roles) with O(1) lookups = ~3 operations for typical use NOTE: Never touches role.Name or role.Description - zero overhead
func (*RBACService) ListRoles ¶
func (s *RBACService) ListRoles() []*Role
GetAllRoles returns all roles with metadata (for API endpoint) This is called rarely (only when fetching available roles for UI)
func (*RBACService) ValidateRole ¶
func (s *RBACService) ValidateRole(roleName string) bool
ValidateRole checks if role exists in definitions
Click to show internal directories.
Click to hide internal directories.