permission

package
v0.19.0 Latest Latest
Warning

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

Go to latest
Published: Jun 26, 2018 License: Apache-2.0 Imports: 3 Imported by: 33

Documentation

Index

Constants

This section is empty.

Variables

View Source
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

func PermFlagFromStringList(permissions []string) (types.PermFlag, error)

Builds a composite PermFlag by mapping each permission string in permissions to its flag and composing them with binary or

func PermFlagToStringList

func PermFlagToStringList(permFlag types.PermFlag) ([]string, error)

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

func String

func String(permFlag types.PermFlag) string

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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