rbac

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2017 License: Apache-2.0 Imports: 2 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.

func NewSessionRoleManager added in v1.2.0

func NewSessionRoleManager(maxHierarchyLevel int) RoleManager

NewSessionRoleManager is the constructor for creating an instance of the SessionRoleManager 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.

func SessionRoleManager added in v1.2.0

func SessionRoleManager() RoleManagerConstructor

SessionRoleManager provides an implementation for the RoleManagerConstructor that supports RBAC sessions with a start time and an end time.

type Session added in v1.2.0

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

Session represents the activation of a role inheritance for a specified time. A role inheritance is always bound to its temporal validity. As soon as a session loses its validity, the corresponding role inheritance becomes invalid too.

type SessionRole added in v1.2.0

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

SessionRole is a modified version of the default role. A SessionRole not only has a name, but also a list of sessions.

Jump to

Keyboard shortcuts

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