Documentation ¶
Index ¶
- Variables
- func BasePermissionsFromStringList(permissions []string) (types.BasePermissions, error)
- func BasePermissionsString(basePermissions types.BasePermissions) string
- func BasePermissionsToStringList(basePermissions types.BasePermissions) ([]string, error)
- func ConvertPermissionsMapAndRolesToAccountPermissions(permissions map[string]bool, roles []string) (*types.AccountPermissions, error)
- func PermFlagFromStringList(permissions []string) (types.PermFlag, error)
- func PermFlagToStringList(permFlag types.PermFlag) ([]string, error)
- func String(permFlag types.PermFlag) string
Constants ¶
This section is empty.
Variables ¶
var ( ZeroBasePermissions = types.BasePermissions{0, 0} ZeroAccountPermissions = types.AccountPermissions{ Base: ZeroBasePermissions, } DefaultAccountPermissions = types.AccountPermissions{ Base: types.BasePermissions{ Perms: types.DefaultPermFlags, SetBit: types.AllPermFlags, }, Roles: []string{}, } AllAccountPermissions = types.AccountPermissions{ Base: types.BasePermissions{ Perms: types.AllPermFlags, SetBit: types.AllPermFlags, }, Roles: []string{}, } )
Functions ¶
func BasePermissionsFromStringList ¶
func BasePermissionsFromStringList(permissions []string) (types.BasePermissions, error)
Builds a composite BasePermission by creating a PermFlag from permissions strings and setting them all
func BasePermissionsString ¶
func BasePermissionsString(basePermissions types.BasePermissions) string
Generates a human readable string from the resultant permissions of basePermission
func BasePermissionsToStringList ¶
func BasePermissionsToStringList(basePermissions types.BasePermissions) ([]string, error)
Builds a list of set permissions from a BasePermission by creating a list of permissions strings from the resultant permissions of basePermissions
func ConvertPermissionsMapAndRolesToAccountPermissions ¶
func ConvertPermissionsMapAndRolesToAccountPermissions(permissions map[string]bool, roles []string) (*types.AccountPermissions, error)
ConvertMapStringIntToPermissions converts a map of string-bool pairs and a slice of strings for the roles to an AccountPermissions type. If the value in the permissions map is true for a particular permission string then the permission will be set in the AccountsPermissions. For all unmentioned permissions the ZeroBasePermissions is defaulted to.
func PermFlagFromStringList ¶
Builds a composite PermFlag by mapping each permission string in permissions to its flag and composing them with binary or
func PermFlagToStringList ¶
Creates a list of individual permission flag strings from a possibly composite PermFlag by projecting out each bit and adding its permission string if it is set
Types ¶
This section is empty.