public class DummyRoleMembershipPolicy extends BaseRoleMembershipPolicy
Constructor and Description |
---|
DummyRoleMembershipPolicy() |
Modifier and Type | Method and 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 |
verifyPolicy(Role role)
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.
|
verifyPolicy
public void checkRoles(long[] userIds, long[] addRoleIds, long[] removeRoleIds)
RoleMembershipPolicy
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.
userIds
- the primary keys of the users to be added and removed from
the rolesaddRoleIds
- the primary keys of the roles to be added (optionally
null
)removeRoleIds
- the primary keys of the roles to be removed
(optionally null
)public boolean isRoleAllowed(long userId, long roleId)
RoleMembershipPolicy
true
if the role can be added to the user. Liferay's
UI calls this method.isRoleAllowed
in interface RoleMembershipPolicy
isRoleAllowed
in class BaseRoleMembershipPolicy
userId
- the primary key of the userroleId
- the primary key of the roletrue
if the role can be added to the user;
false
otherwisepublic boolean isRoleRequired(long userId, long roleId)
RoleMembershipPolicy
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.isRoleRequired
in interface RoleMembershipPolicy
isRoleRequired
in class BaseRoleMembershipPolicy
userId
- the primary key of the userroleId
- the primary key of the roletrue
if the role is mandatory for the user;
false
otherwisepublic void propagateRoles(long[] userIds, long[] addRoleIds, long[] removeRoleIds)
RoleMembershipPolicy
The actions must ensure the membership policy of each role. For example, some actions for implementations to consider performing are:
userIds
- the primary keys of the usersaddRoleIds
- the primary keys of the added rolesremoveRoleIds
- the primary keys of the removed rolespublic void verifyPolicy(Role role)
RoleMembershipPolicy
verifyPolicy
in interface RoleMembershipPolicy
verifyPolicy
in class BaseRoleMembershipPolicy
role
- the role to verifypublic void verifyPolicy(Role role, Role oldRole, Map<String,Serializable> oldExpandoAttributes)
RoleMembershipPolicy
role
- the added or updated role to verifyoldRole
- the old roleoldExpandoAttributes
- the old expando attributes