acl

package
v0.1.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 21, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// APIUserIDBase is the high bit; API userIDs are 0x80000000 | users.id.
	// Max users.id is typically small, so 0x80000001, 0x80000002, etc.
	APIUserIDBase uint32 = 0x80000000
	// APIUserIDMask extracts the DB id from a synthetic userID.
	APIUserIDMask uint32 = 0x7FFFFFFF
)

RBAC constants for API user ID mapping. API users (from the management API users table) receive synthetic Mumble userIDs in a reserved range to avoid collision with registered_users (1, 2, 3...) and SuperUser (0). This allows the ACL evaluator to resolve API roles for @admin.

Variables

This section is empty.

Functions

func APIUserIDToDBID

func APIUserIDToDBID(userID uint32) uint

APIUserIDToDBID extracts the users.id from a synthetic userID. Returns 0 if not an API userID.

func EnsureDefaultRootACLs

func EnsureDefaultRootACLs(db *gorm.DB, serverID uint) error

EnsureDefaultRootACLs seeds default ACLs and groups for the root channel if none exist.

func IsAPIUserID

func IsAPIUserID(userID uint32) bool

IsAPIUserID returns true if userID is in the API user range.

func IsAdminForDisplay

func IsAdminForDisplay(db *gorm.DB, serverID uint, userID uint32) bool

IsAdminForDisplay returns true if the user has admin privileges (API admin or stored admin group). Used by the REST API when returning connected users for display in the channel tree. Note: userID 0 (server-password users not in registered_users) are not shown as admin.

func MakeAPIUserID

func MakeAPIUserID(apiUserDBID uint) uint32

MakeAPIUserID creates a synthetic Mumble userID for an API user (users.id).

func ResolveAPIAdmin

func ResolveAPIAdmin(db *gorm.DB, userID uint32) bool

ResolveAPIAdmin returns true if the userID belongs to an API user with role=admin. Used by the ACL evaluator for @admin when userID is in the API user range.

Types

type Evaluator

type Evaluator struct {
	// contains filtered or unexported fields
}

Evaluator resolves permissions for a user in a channel using DB ACLs and groups.

func NewEvaluator

func NewEvaluator(db *gorm.DB, chans *channel.Manager, users *user.Manager) *Evaluator

NewEvaluator creates an ACL evaluator with DB and manager dependencies.

func (*Evaluator) Check

func (e *Evaluator) Check(userID uint32, channelID uint32, perm mumble.Permission) bool

Check returns whether the user has the given permission in the channel.

func (*Evaluator) EffectivePermissions

func (e *Evaluator) EffectivePermissions(userID uint32, channelID uint32) uint32

EffectivePermissions returns the permission bitmask for userID in channelID.

func (*Evaluator) InvalidateCache

func (e *Evaluator) InvalidateCache()

InvalidateCache clears the permission cache. Call when ACLs, groups, or user state change.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL