permissions

package
v0.13.2 Latest Latest
Warning

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

Go to latest
Published: Oct 6, 2022 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CanReadResource

func CanReadResource(ctx context.Context, resource string) (ok bool, err errors.CodeError)

func CanWriteResource

func CanWriteResource(ctx context.Context, resource string) (ok bool, err errors.CodeError)

func RemoveRole

func RemoveRole(ctx context.Context, name string) (err errors.CodeError)

func SaveRole

func SaveRole(ctx context.Context, role Role) (err errors.CodeError)

func UserBindRoles

func UserBindRoles(ctx context.Context, userId string, roles ...string) (err errors.CodeError)

func UserUnbindRoles

func UserUnbindRoles(ctx context.Context, userId string, roles ...string) (err errors.CodeError)

func Verify

func Verify(ctx context.Context, roles ...string) (err errors.CodeError)

Types

type Role

type Role interface {
	Name() string
	Parent(ctx context.Context) (parent Role, err errors.CodeError)
	SetParent(parent Role)
	RemoveParent()
	Children() []Role
	AddChild(child Role)
	RemoveChild(child Role)
	AddReadableResource(resource string)
	AddWriteableResource(resource string)
	AddReadableAndWriteableResource(resource string)
	Contains(roles []string) (ok bool)
	CanReadResource(resource string) (ok bool)
	CanWriteResource(resource string) (ok bool)
}

func GetRole

func GetRole(ctx context.Context, name string) (v Role, err errors.CodeError)

func GetRoles

func GetRoles(ctx context.Context) (v []Role, err errors.CodeError)

func GetUserRoles

func GetUserRoles(ctx context.Context, userId string) (v []Role, err errors.CodeError)

func NewRole

func NewRole(name string) (v Role)

Jump to

Keyboard shortcuts

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