Class DummyRoleMembershipPolicy

Object
com.liferay.portal.kernel.security.membershippolicy.BaseRoleMembershipPolicy
com.liferay.portal.kernel.security.membershippolicy.DummyRoleMembershipPolicy
All Implemented Interfaces:
RoleMembershipPolicy

public class DummyRoleMembershipPolicy extends BaseRoleMembershipPolicy
Author:
Brian Wing Shun Chan, Roberto Díaz, Sergio González
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    checkRoles(long[] userIds, long[] addRoleIds, long[] removeRoleIds)
    Checks if the roles can be added to or removed from their users.
    boolean
    isRoleAllowed(long userId, long roleId)
    Returns true if the role can be added to the user.
    boolean
    isRoleRequired(long userId, long roleId)
    Returns true if the role is mandatory for the user.
    void
    propagateRoles(long[] userIds, long[] addRoleIds, long[] removeRoleIds)
    Performs membership policy related actions after the respective roles are added to and removed from the affected users.
    void
    Checks the integrity of the membership policy of the role and performs operations necessary for the compliance of the role.
    void
    verifyPolicy(Role role, Role oldRole, Map<String,Serializable> oldExpandoAttributes)
    Checks the integrity of the membership policy of the role, with respect to the role's new attribute values and expando attributes, and performs operations necessary for the role's compliance.

    Methods inherited from class com.liferay.portal.kernel.security.membershippolicy.BaseRoleMembershipPolicy

    verifyPolicy

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • DummyRoleMembershipPolicy

      public DummyRoleMembershipPolicy()
  • Method Details

    • checkRoles

      public void checkRoles(long[] userIds, long[] addRoleIds, long[] removeRoleIds)
      Description copied from interface: RoleMembershipPolicy
      Checks if the roles can be added to or removed from their users.

      Liferay's core services call this method before adding the users to and removing the users from the respective roles. If this method throws an exception, the service foregoes making the changes.

      Parameters:
      userIds - the primary keys of the users to be added and removed from the roles
      addRoleIds - the primary keys of the roles to be added (optionally null)
      removeRoleIds - the primary keys of the roles to be removed (optionally null)
    • isRoleAllowed

      public boolean isRoleAllowed(long userId, long roleId)
      Description copied from interface: RoleMembershipPolicy
      Returns true if the role can be added to the user. Liferay's UI calls this method.
      Specified by:
      isRoleAllowed in interface RoleMembershipPolicy
      Overrides:
      isRoleAllowed in class BaseRoleMembershipPolicy
      Parameters:
      userId - the primary key of the user
      roleId - the primary key of the role
      Returns:
      true if the role can be added to the user; false otherwise
    • isRoleRequired

      public boolean isRoleRequired(long userId, long roleId)
      Description copied from interface: RoleMembershipPolicy
      Returns true if the role is mandatory for the user. Liferay's UI, for example, calls this method in deciding whether the checkbox to select a role will be enable.
      Specified by:
      isRoleRequired in interface RoleMembershipPolicy
      Overrides:
      isRoleRequired in class BaseRoleMembershipPolicy
      Parameters:
      userId - the primary key of the user
      roleId - the primary key of the role
      Returns:
      true if the role is mandatory for the user; false otherwise
    • propagateRoles

      public void propagateRoles(long[] userIds, long[] addRoleIds, long[] removeRoleIds)
      Description copied from interface: RoleMembershipPolicy
      Performs membership policy related actions after the respective roles are added to and removed from the affected users. Liferay's core services call this method after the roles are added to and removed from the users.

      The actions must ensure the membership policy of each role. For example, some actions for implementations to consider performing are:

      • If the role A is added to a user, role B should be added too.
      • If the role A is removed from a user, role B should be removed too.
      Parameters:
      userIds - the primary keys of the users
      addRoleIds - the primary keys of the added roles
      removeRoleIds - the primary keys of the removed roles
    • verifyPolicy

      public void verifyPolicy(Role role)
      Description copied from interface: RoleMembershipPolicy
      Checks the integrity of the membership policy of the role and performs operations necessary for the compliance of the role.
      Specified by:
      verifyPolicy in interface RoleMembershipPolicy
      Overrides:
      verifyPolicy in class BaseRoleMembershipPolicy
      Parameters:
      role - the role to verify
    • verifyPolicy

      public void verifyPolicy(Role role, Role oldRole, Map<String,Serializable> oldExpandoAttributes)
      Description copied from interface: RoleMembershipPolicy
      Checks the integrity of the membership policy of the role, with respect to the role's new attribute values and expando attributes, and performs operations necessary for the role's compliance. Liferay calls this method when adding and updating roles.
      Parameters:
      role - the added or updated role to verify
      oldRole - the old role
      oldExpandoAttributes - the old expando attributes