Documentation ¶
Overview ¶
Package rbac provides role-based access control.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Enforcer ¶
type Enforcer struct {
// contains filtered or unexported fields
}
func (*Enforcer) GetTargets ¶
GetTargets generates all appropriate targets for a member or user.
func (*Enforcer) HasPermission ¶
func (e *Enforcer) HasPermission(guildID string, userID string, permissions ...Permission) (bool, error)
HasPermission checks whether a member or user has all of the permissions.
type Target ¶
type Target struct { GuildID string Type TargetType ID string }
Target is an identifier to which a role can be assigned.
Syntax: `[<guild id>:][<type>]<id>`
As you can see both the guild id and the target type are optional. A missing guild id indicates a global target and a missing type stands for a user target type.
func ParseTarget ¶
ParseTarget parses a raw target into
func TargetMember ¶
TargetMember creates a new target for a guild member.
func TargetRole ¶
TargetRole creates a new target for a role.
func (Target) GuildTarget ¶
GuildTarget returns the target without the guild specifier.
type TargetType ¶
type TargetType rune
TargetType represents the type of entity a target targets.
const ( UserTargetType TargetType = 0 // Target user SpecialTargetType TargetType = '$' // Special target RoleTargetType TargetType = '@' // Target role )
func GetTargetType ¶
func GetTargetType(r rune) (TargetType, bool)
GetTargetType determines the target type from its rune representation.
Click to show internal directories.
Click to hide internal directories.