Class GroupRoleManager

  • All Implemented Interfaces:
    RoleManager

    public class GroupRoleManager
    extends DefaultRoleManager
    GroupRoleManager is used for authorization if the user's group is the role who has permission, but the group information is in the default format (policy start with "g") and the role information is in named format (policy start with "g2", "g3", ...). e.g. p, admin, domain1, data1, read g, alice, group1 g2, group1, admin, domain1 As for the previous example, alice should have the permission to read data1, but if we use the DefaultRoleManager, it will return false. GroupRoleManager is to handle this situation.
    • Constructor Detail

      • GroupRoleManager

        public GroupRoleManager​(int maxHierarchyLevel)
        GroupRoleManager is the constructor for creating an instance of the GroupRoleManager implementation.
        Parameters:
        maxHierarchyLevel - the maximized allowed RBAC hierarchy level.
    • Method Detail

      • hasLink

        public boolean hasLink​(java.lang.String name1,
                               java.lang.String name2,
                               java.lang.String... domain)
        hasLink determines whether role: name1 inherits role: name2. domain is a prefix to the roles.
        Specified by:
        hasLink in interface RoleManager
        Overrides:
        hasLink in class DefaultRoleManager
        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).