Package org.casbin.jcasbin.rbac
Class DomainManager
java.lang.Object
org.casbin.jcasbin.rbac.DomainManager
- All Implemented Interfaces:
RoleManager
- Author:
- Yixiang Zhao (@seriouszyx)
-
Constructor Summary
ConstructorsConstructorDescriptionDomainManager(int maxHierarchyLevel) DomainManager(int maxHierarchyLevel, BiPredicate<String, String> matchingFunc, BiPredicate<String, String> domainMatchingFunc) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddDomainMatchingFunc(String name, BiPredicate<String, String> domainMatchingFunc) voidaddLink adds the inheritance link between two roles. role: name1 and role: name2. domain is a prefix to the roles.voidaddMatchingFunc(String name, BiPredicate<String, String> matchingFunc) voidclear()Clear clears all stored data and resets the role manager to the initial state.voiddeleteLink(String name1, String name2, String... domain) deleteLink deletes the inheritance link between two roles. role: name1 and role: name2.getRoles gets the roles that a user inherits. domain is a prefix to the roles.getUsers gets the users that inherits a role.booleanhasLink determines whether a link exists between two roles. role: name1 inherits role: name2.voidprintRoles prints all the roles to log.toString()
-
Constructor Details
-
DomainManager
public DomainManager(int maxHierarchyLevel) -
DomainManager
public DomainManager(int maxHierarchyLevel, BiPredicate<String, String> matchingFunc, BiPredicate<String, String> domainMatchingFunc)
-
-
Method Details
-
addMatchingFunc
-
addDomainMatchingFunc
-
clear
public void clear()Description copied from interface:RoleManagerClear clears all stored data and resets the role manager to the initial state.- Specified by:
clearin interfaceRoleManager
-
addLink
Description copied from interface:RoleManageraddLink adds the inheritance link between two roles. role: name1 and role: name2. domain is a prefix to the roles.- Specified by:
addLinkin interfaceRoleManager- Parameters:
name1- the first role (or user).name2- the second role.domain- the domain the roles belong to.
-
deleteLink
Description copied from interface:RoleManagerdeleteLink deletes the inheritance link between two roles. role: name1 and role: name2. domain is a prefix to the roles.- Specified by:
deleteLinkin interfaceRoleManager- Parameters:
name1- the first role (or user).name2- the second role.domain- the domain the roles belong to.
-
hasLink
Description copied from interface:RoleManagerhasLink determines whether a link exists between two roles. role: name1 inherits role: name2. domain is a prefix to the roles.- Specified by:
hasLinkin interfaceRoleManager- Parameters:
name1- the first role (or a user).name2- the second role.domain- the domain the roles belong to.- Returns:
- whether name1 inherits name2 (name1 has role name2).
-
getRoles
Description copied from interface:RoleManagergetRoles gets the roles that a user inherits. domain is a prefix to the roles.- Specified by:
getRolesin interfaceRoleManager- Parameters:
name- the user (or a role).domain- the domain the roles belong to.- Returns:
- the roles.
-
getUsers
Description copied from interface:RoleManagergetUsers gets the users that inherits a role.- Specified by:
getUsersin interfaceRoleManager- Parameters:
name- the role.domain- is a prefix to the users (can be used for other purposes).- Returns:
- the users.
-
toString
-
printRoles
public void printRoles()Description copied from interface:RoleManagerprintRoles prints all the roles to log.- Specified by:
printRolesin interfaceRoleManager
-