roles

package
v0.0.0-...-e7b361f Latest Latest
Warning

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

Go to latest
Published: Aug 6, 2018 License: MIT Imports: 1 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Permission

type Permission string

Permission is an action that a user is allowed to perform.

type Permissions

type Permissions map[Permission]bool

Permissions contains permissions that have been granted.

func (Permissions) Add

func (p Permissions) Add(permissions ...Permission)

Add adds permissions.

func (Permissions) Has

func (p Permissions) Has(permission Permission) bool

Has returns whether permission has been granted.

func (Permissions) HasOne

func (p Permissions) HasOne(permissions ...Permission) bool

HasOne returns whether one of the provided permissions has been granted.

func (Permissions) MarshalJSON

func (p Permissions) MarshalJSON() ([]byte, error)

MarshalJSON JSON encodes the map.

func (Permissions) Remove

func (p Permissions) Remove(permissions ...Permission)

Remove removes permissions.

type Role

type Role struct {
	ID          int
	Name        string
	Permissions Permissions
}

Role of a user.

func New

func New(id int, name string, permissions ...Permission) *Role

New returns a new Role.

Jump to

Keyboard shortcuts

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