Class DomainManager
java.lang.Object
org.casbin.jcasbin.rbac.DomainManager
- All Implemented Interfaces:
RoleManager
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final Stringprivate BiPredicate<String, String> private SyncedLRUCache<String, Boolean> private BiPredicate<String, String> private intprivate Map<String, DefaultRoleManager> -
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.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.private StringdomainName(String... domain) private DefaultRoleManagergetRoleManager(String domain, boolean store) getRoles gets the roles that a user inherits.getUsers gets the users that inherits a role.booleanhasLink determines whether a link exists between two roles.private booleanvoidprintRoles prints all the roles to log.private voidrebuild()rebuild clears the map of RoleManagerstoString()
-
Field Details
-
DEFAULT_DOMAIN
- See Also:
-
rmMap
-
maxHierarchyLevel
private int maxHierarchyLevel -
matchingFunc
-
domainMatchingFunc
-
domainMatchingFuncCache
-
-
Constructor Details
-
DomainManager
public DomainManager(int maxHierarchyLevel) -
DomainManager
public DomainManager(int maxHierarchyLevel, BiPredicate<String, String> matchingFunc, BiPredicate<String, String> domainMatchingFunc)
-
-
Method Details
-
addMatchingFunc
-
addDomainMatchingFunc
-
rebuild
private void rebuild()rebuild clears the map of RoleManagers -
domainName
-
getRoleManager
-
match
-
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
-