MCPcopy
hub / github.com/apache/casbin / RoleManager

Interface RoleManager

rbac/role_manager.go:22–62  ·  view source on GitHub ↗

RoleManager provides interface to define the operations for managing roles.

Source from the content-addressed store, hash-verified

20
21// RoleManager provides interface to define the operations for managing roles.
22type RoleManager interface {
23 // Clear clears all stored data and resets the role manager to the initial state.
24 Clear() error
25 // AddLink adds the inheritance link between two roles. role: name1 and role: name2.
26 // domain is a prefix to the roles (can be used for other purposes).
27 AddLink(name1 string, name2 string, domain ...string) error
28 // Deprecated: BuildRelationship is no longer required
29 BuildRelationship(name1 string, name2 string, domain ...string) error
30 // DeleteLink deletes the inheritance link between two roles. role: name1 and role: name2.
31 // domain is a prefix to the roles (can be used for other purposes).
32 DeleteLink(name1 string, name2 string, domain ...string) error
33 // HasLink determines whether a link exists between two roles. role: name1 inherits role: name2.
34 // domain is a prefix to the roles (can be used for other purposes).
35 HasLink(name1 string, name2 string, domain ...string) (bool, error)
36 // GetRoles gets the roles that a user inherits.
37 // domain is a prefix to the roles (can be used for other purposes).
38 GetRoles(name string, domain ...string) ([]string, error)
39 // GetUsers gets the users that inherits a role.
40 // domain is a prefix to the users (can be used for other purposes).
41 GetUsers(name string, domain ...string) ([]string, error)
42 // GetImplicitRoles gets the implicit roles that a user inherits, respecting maxHierarchyLevel.
43 // domain is a prefix to the roles (can be used for other purposes).
44 GetImplicitRoles(name string, domain ...string) ([]string, error)
45 // GetImplicitUsers gets the implicit users that inherits a role, respecting maxHierarchyLevel.
46 // domain is a prefix to the users (can be used for other purposes).
47 GetImplicitUsers(name string, domain ...string) ([]string, error)
48 // GetDomains gets domains that a user has
49 GetDomains(name string) ([]string, error)
50 // GetAllDomains gets all domains
51 GetAllDomains() ([]string, error)
52 // PrintRoles prints all the roles to log.
53 PrintRoles() error
54 // Match matches the domain with the pattern
55 Match(str string, pattern string) bool
56 // AddMatchingFunc adds the matching function
57 AddMatchingFunc(name string, fn MatchingFunc)
58 // AddDomainMatchingFunc adds the domain matching function
59 AddDomainMatchingFunc(name string, fn MatchingFunc)
60 // DeleteDomain deletes all data of a domain in the role manager.
61 DeleteDomain(domain string) error
62}
63
64// ConditionalRoleManager provides interface to define the operations for managing roles.
65// Link with conditions is supported.

Callers 72

TestClearFunction · 0.95
TestMatchingFuncOrderFunction · 0.95
rebuildMethod · 0.65
TestRoleFunction · 0.95
TestDomainRoleFunction · 0.95
TestClearFunction · 0.95
TestDomainPatternRoleFunction · 0.95
TestAllMatchingFuncFunction · 0.95
TestMatchingFuncOrderFunction · 0.95

Implementers 3

RoleManagerImplrbac/default-role-manager/role_manager
DomainManagerrbac/default-role-manager/role_manager

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…