Class DomainManager

java.lang.Object
org.casbin.jcasbin.rbac.DomainManager
All Implemented Interfaces:
RoleManager

public class DomainManager extends Object implements RoleManager
  • Field Details

  • Constructor Details

  • Method Details

    • addMatchingFunc

      public void addMatchingFunc(String name, BiPredicate<String,String> matchingFunc)
    • addDomainMatchingFunc

      public void addDomainMatchingFunc(String name, BiPredicate<String,String> domainMatchingFunc)
    • rebuild

      private void rebuild()
      rebuild clears the map of RoleManagers
    • domainName

      private String domainName(String... domain)
    • getRoleManager

      private DefaultRoleManager getRoleManager(String domain, boolean store)
    • match

      private boolean match(String str, String pattern)
    • clear

      public void clear()
      Description copied from interface: RoleManager
      Clear clears all stored data and resets the role manager to the initial state.
      Specified by:
      clear in interface RoleManager
    • addLink

      public void addLink(String name1, String name2, String... domain)
      Description copied from interface: RoleManager
      addLink adds the inheritance link between two roles. role: name1 and role: name2. domain is a prefix to the roles.
      Specified by:
      addLink in interface RoleManager
      Parameters:
      name1 - the first role (or user).
      name2 - the second role.
      domain - the domain the roles belong to.
    • deleteLink

      public void deleteLink(String name1, String name2, String... domain)
      Description copied from interface: RoleManager
      deleteLink deletes the inheritance link between two roles. role: name1 and role: name2. domain is a prefix to the roles.
      Specified by:
      deleteLink in interface RoleManager
      Parameters:
      name1 - the first role (or user).
      name2 - the second role.
      domain - the domain the roles belong to.
    • hasLink

      public boolean hasLink(String name1, String name2, String... domain)
      Description copied from interface: RoleManager
      hasLink determines whether a link exists between two roles. role: name1 inherits role: name2. domain is a prefix to the roles.
      Specified by:
      hasLink in interface RoleManager
      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

      public List<String> getRoles(String name, String... domain)
      Description copied from interface: RoleManager
      getRoles gets the roles that a user inherits. domain is a prefix to the roles.
      Specified by:
      getRoles in interface RoleManager
      Parameters:
      name - the user (or a role).
      domain - the domain the roles belong to.
      Returns:
      the roles.
    • getUsers

      public List<String> getUsers(String name, String... domain)
      Description copied from interface: RoleManager
      getUsers gets the users that inherits a role.
      Specified by:
      getUsers in interface RoleManager
      Parameters:
      name - the role.
      domain - is a prefix to the users (can be used for other purposes).
      Returns:
      the users.
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • printRoles

      public void printRoles()
      Description copied from interface: RoleManager
      printRoles prints all the roles to log.
      Specified by:
      printRoles in interface RoleManager