rbac

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2017 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Role

type Role struct {
	// contains filtered or unexported fields
}

Role represents the data structure for a role in RBAC.

type RoleManager

type RoleManager interface {
	// AddLink adds the inheritance link between two roles. role: name1 and role: name2.
	// domain is a prefix to the roles (can be used for other purposes).
	AddLink(name1 string, name2 string, domain ...string)
	// DeleteLink deletes the inheritance link between two roles. role: name1 and role: name2.
	// domain is a prefix to the roles (can be used for other purposes).
	DeleteLink(name1 string, name2 string, domain ...string)
	// HasLink determines whether a link exists between two roles. role: name1 inherits role: name2.
	// domain is a prefix to the roles (can be used for other purposes).
	HasLink(name1 string, name2 string, domain ...string) bool
	// GetRoles gets the roles that a user inherits.
	// domain is a prefix to the roles (can be used for other purposes).
	GetRoles(name string, domain ...string) []string
	// GetUsers gets the users that inherits a role.
	// domain is a prefix to the users (can be used for other purposes).
	GetUsers(name string, domain ...string) []string
	// PrintRoles prints all the roles to log.
	PrintRoles()
}

RoleManager provides interface to define the operations for managing roles.

func NewDefaultRoleManager added in v1.0.0

func NewDefaultRoleManager(level int) RoleManager

NewDefaultRoleManager is the constructor for creating an instance of the default RoleManager implementation.

type RoleManagerConstructor added in v1.0.0

type RoleManagerConstructor func() RoleManager

RoleManagerConstructor provides a definition for constructing a RoleManager.

func DefaultRoleManager added in v1.0.0

func DefaultRoleManager() RoleManagerConstructor

DefaultRoleManager provides an implementation for the RoleManagerConstructor that creates the default RoleManager as it was previously created.

Jump to

Keyboard shortcuts

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