Documentation
¶
Overview ¶
Package rbac provides role-based access control for Prism. Roles map user identities (profile names) to named permission sets.
Index ¶
- Constants
- type AssignRoleRequest
- type Manager
- func (m *Manager) AssignRole(userID, roleID, assignedBy string) error
- func (m *Manager) CanPerformAction(userID, action string) (bool, string)
- func (m *Manager) GetUserRole(userID string) *Role
- func (m *Manager) ListRoles() []*Role
- func (m *Manager) ListUserAssignments() map[string]string
- func (m *Manager) RemoveRole(userID string) error
- type Role
- type UserRole
Constants ¶
const ( RoleAdmin = "admin" RoleResearcher = "researcher" RoleStudent = "student" RoleViewer = "viewer" )
Built-in role IDs.
const ( ActionInstancesLaunch = "instances:launch" ActionInstancesStop = "instances:stop" ActionInstancesStart = "instances:start" ActionInstancesTerminate = "instances:terminate" ActionInstancesView = "instances:view" ActionInstancesConnect = "instances:connect" ActionStorageCreate = "storage:create" ActionStorageDelete = "storage:delete" ActionStorageAttach = "storage:attach" ActionStorageDetach = "storage:detach" ActionStorageView = "storage:view" ActionTemplatesView = "templates:view" ActionProfilesView = "profiles:view" ActionProfilesManage = "profiles:manage" ActionPoliciesManage = "policies:manage" ActionAuditView = "audit:view" ActionRBACManage = "rbac:manage" )
Well-known action strings used across the daemon for permission checks.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AssignRoleRequest ¶
AssignRoleRequest is the request body for POST /api/v1/rbac/assign.
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager handles role-based access control for Prism. User identities are profile names (as returned by profile.GetCurrentProfile().Name). Assignments are persisted to ~/.prism/rbac.json.
func NewManager ¶
NewManager creates a Manager with built-in default roles and loads any persisted assignments.
func (*Manager) AssignRole ¶
AssignRole assigns a named role to a user ID, persisting the assignment.
func (*Manager) CanPerformAction ¶
CanPerformAction returns (allowed, reason) for the given user and action string. action format: "instances:launch", "storage:delete", etc.
func (*Manager) GetUserRole ¶
GetUserRole returns the role for a user. Defaults to the researcher role if no assignment exists.
func (*Manager) ListUserAssignments ¶
ListUserAssignments returns all explicit user→role mappings.
func (*Manager) RemoveRole ¶
RemoveRole removes any role assignment for the user, reverting to the default researcher role.