Documentation
¶
Overview ¶
Copyright (c) 2010-2013 The Grumble Authors The use of this source code is goverened by a BSD-style license that can be found in the LICENSE-file.
Index ¶
Constants ¶
const ( // Per-channel permissions NonePermission = 0x0 WritePermission = 0x1 TraversePermission = 0x2 EnterPermission = 0x4 SpeakPermission = 0x8 MuteDeafenPermission = 0x10 MovePermission = 0x20 MakeChannelPermission = 0x40 LinkChannelPermission = 0x80 WhisperPermission = 0x100 TextMessagePermission = 0x200 TempChannelPermission = 0x400 // Root channel only KickPermission = 0x10000 BanPermission = 0x20000 RegisterPermission = 0x40000 SelfRegisterPermission = 0x80000 // Extra flags CachedPermission = 0x8000000 AllPermissions = 0xf07ff )
Variables ¶
This section is empty.
Functions ¶
func GroupMemberCheck ¶
GroupMemberCheck checks whether a user is a member of the group as defined in the given context.
The 'current' context is the context that group membership is currently being evaluated for.
The 'acl' context is the context of the ACL that that group membership is being evaluated for.
The acl context will always be either equal to current, or be an ancestor.
func HasPermission ¶
func HasPermission(ctx *Context, user User, perm Permission) bool
HasPermission checks whether the given user has permission perm in the given context. The permission perm must be a single permission and not a combination of permissions.
Types ¶
type ACL ¶
type ACL struct { // The user id that this ACL applied to. If this // field is -1, the ACL is a group ACL. UserId int // The group that this ACL applies to. Group string // The ApplyHere flag determines whether the ACL // should apply to the current channel. ApplyHere bool // The ApplySubs flag determines whethr the ACL // should apply to subchannels. ApplySubs bool // The allowed permission flags. Allow Permission // The allowed permission flags. The Deny flags override // permissions set in Allow. Deny Permission }
An ACL as defined in an ACL context. An ACL can be defined for either a user or a group.
func (*ACL) IsChannelACL ¶
IsChannelACL returns true if the ACL is defined for a group, as opposed to a user.
type Channel ¶
type Channel interface {
ChannelId() int
}
Channel represents a Channel on a Mumble server.
type Context ¶
type Context struct { // Parent points to the context's parent. // May be nil if the Context does not have a parent. Parent *Context // ACLs is the Context's list of ACL entries. ACLs []ACL // Groups is the Context's representation of groups. // It is indexed by the Group's name. Groups map[string]Group // InheritACL determines whether this context should // inherit ACLs from its parent. InheritACL bool }
Context represents a context in which ACLs can be understood. Typically embedded into a type that represents a Mumble channel.
func (*Context) GroupNames ¶
GroupNames gets the list of group names for the given ACL context.
This function walks the through the context chain to figure out all groups that affect the given context whilst considering group inheritance.
type Group ¶
type Group struct { // The name of this group Name string // The inherit flag means that this group will inherit group // members from its parent. Inherit bool // The inheritable flag means that subchannels can // inherit the members of this group. Inheritable bool // Group adds permissions to these users Add map[int]bool // Group removes permissions from these users Remove map[int]bool // Temporary add (authenticators) Temporary map[int]bool }
Group represents a Group in an Context.
func EmptyGroupWithName ¶
EmptyGroupWithName creates a new Group with the given name.
func (*Group) AddContains ¶
AddContains checks whether the Add set contains id.
func (*Group) MembersInContext ¶
MembersInContext gets the set of user id's from the group in the given context. This includes group members that have been inherited from an ancestor context.
func (*Group) RemoveContains ¶
RemoveContains checks whether the Remove set contains id.
func (*Group) RemoveUsers ¶
RemoveUsers gets the list of user ids in the Remove set.
func (*Group) TemporaryContains ¶
TemporaryContains checks whether the Temporary set contains id.
type Permission ¶
type Permission uint32
Permission represents a permission in Mumble's ACL system.
func (Permission) Clean ¶
func (perm Permission) Clean() Permission
Clean returns a Permission that has its cache bit cleared.
func (Permission) IsCached ¶
func (perm Permission) IsCached() bool
IsCached checks whether the ACL has its cache bit set, signalling that it was returned from an ACLCache.