com.liferay.portal.security.membershippolicy
Class BaseRoleMembershipPolicy
java.lang.Object
com.liferay.portal.security.membershippolicy.BaseRoleMembershipPolicy
- All Implemented Interfaces:
- RoleMembershipPolicy
- Direct Known Subclasses:
- DummyRoleMembershipPolicy
public abstract class BaseRoleMembershipPolicy
- extends Object
- implements RoleMembershipPolicy
Method Summary |
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 |
verifyPolicy()
Checks the integrity of the membership policy of each of the portal's
roles and performs operations necessary for the compliance of each role. |
void |
verifyPolicy(Role role)
Checks the integrity of the membership policy of the role and performs
operations necessary for the compliance of the role. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
BaseRoleMembershipPolicy
public BaseRoleMembershipPolicy()
isRoleAllowed
public boolean isRoleAllowed(long userId,
long roleId)
throws PortalException,
SystemException
- 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
- Parameters:
userId
- the primary key of the userroleId
- the primary key of the role
- Returns:
true
if the role can be added to the user;
false
otherwise
- Throws:
PortalException
- if a portal exception occurred
SystemException
- if a system exception occurred
isRoleRequired
public boolean isRoleRequired(long userId,
long roleId)
throws PortalException,
SystemException
- 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
- Parameters:
userId
- the primary key of the userroleId
- the primary key of the role
- Returns:
true
if the role is mandatory for the user;
false
otherwise
- Throws:
PortalException
- if a portal exception occurred
SystemException
- if a system exception occurred
verifyPolicy
public void verifyPolicy()
throws PortalException,
SystemException
- Description copied from interface:
RoleMembershipPolicy
- Checks the integrity of the membership policy of each of the portal's
roles and performs operations necessary for the compliance of each role.
This method can be triggered manually from the Control Panel. If the
membership.policy.auto.verify
portal property is
true
this method is triggered when starting Liferay and
every time a membership policy hook is deployed.
- Specified by:
verifyPolicy
in interface RoleMembershipPolicy
- Throws:
PortalException
- if a portal exception occurred
SystemException
- if a system exception occurred
verifyPolicy
public void verifyPolicy(Role role)
throws PortalException,
SystemException
- 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
- Parameters:
role
- the role to verify
- Throws:
PortalException
- if a portal exception occurred
SystemException
- if a system exception occurred