permissions

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2019 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrUserIDNotKnow    = errors.New("Userid has no permission set for this object")
	ErrObjectIDNotKnow  = errors.New("Objectid not know to permission")
	ErrPermissionNotSet = errors.New("PermissionType not set for useid,ojectid tuple")
)

Functions

This section is empty.

Types

type ObjectID

type ObjectID string

type PermissionType

type PermissionType int8
const (
	Create PermissionType = 0
	Read   PermissionType = 1
	Update PermissionType = 2
	Delete PermissionType = 3
	CRUD   PermissionType = 4
)

type Permissions

type Permissions struct {
	Lock sync.RWMutex
	// contains filtered or unexported fields
}

func NewPermissions

func NewPermissions(dir string) (*Permissions, error)

func (*Permissions) BackupTo

func (p *Permissions) BackupTo(bkpDest string) error

func (*Permissions) CheckPermissionAny

func (p *Permissions) CheckPermissionAny(objID, usrID string, permissions ...PermissionType) (bool, error)

func (*Permissions) DeletePermission

func (p *Permissions) DeletePermission(objID, usrID string, permission PermissionType) error

func (*Permissions) GetAllAsMap

func (p *Permissions) GetAllAsMap() (map[string](map[string](map[PermissionType]bool)), error)

func (*Permissions) RemoveUsersPermissions

func (p *Permissions) RemoveUsersPermissions(usrID string) error

func (*Permissions) SetPermission

func (p *Permissions) SetPermission(objID, usrID string, permission PermissionType, value bool) error

type UserID

type UserID string

Jump to

Keyboard shortcuts

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