public abstract class BaseOrganizationMembershipPolicy extends Object implements OrganizationMembershipPolicy
Constructor and Description |
---|
BaseOrganizationMembershipPolicy() |
Modifier and Type | Method and Description |
---|---|
void |
checkRoles(List<UserGroupRole> addUserGroupRoles,
List<UserGroupRole> removeUserGroupRoles)
Checks if the organization roles can be added to or removed from their
users.
|
boolean |
isMembershipAllowed(long userId,
long organizationId)
Returns
true if the user can be added to the organization. |
boolean |
isMembershipProtected(PermissionChecker permissionChecker,
long userId,
long organizationId)
Returns
true if the policy prevents the user from being
removed from the organization by the user associated with the permission
checker. |
boolean |
isMembershipRequired(long userId,
long organizationId)
Returns
true if organization membership for the user is
mandatory. |
boolean |
isRoleAllowed(long userId,
long organizationId,
long roleId)
Returns
true if the role can be added to the user on the
organization. |
boolean |
isRoleProtected(PermissionChecker permissionChecker,
long userId,
long organizationId,
long roleId)
Returns
true if the policy prevents the user from being
removed from the role by the user associated with the permission checker. |
boolean |
isRoleRequired(long userId,
long organizationId,
long roleId)
Returns
true if the role is mandatory for the user on the
organization. |
void |
propagateRoles(List<UserGroupRole> addUserGroupRoles,
List<UserGroupRole> removeUserGroupRoles)
Performs membership policy related actions after the respective
organization roles are added to and removed from the affected users.
|
void |
verifyPolicy()
Checks the integrity of the membership policy of each of the portal's
organizations and performs operations necessary for the compliance of
each organization and organization role.
|
void |
verifyPolicy(Organization organization)
Checks the integrity of the membership policy of the organization and
performs operations necessary for the organization's compliance.
|
void |
verifyPolicy(Role role)
Checks the integrity of the membership policy of the organization role
and performs operations necessary for the role's compliance.
|
void |
verifyPolicy(Role role,
Role oldRole,
Map<String,Serializable> oldExpandoAttributes)
Checks the integrity of the membership policy of the organization role,
with respect to its expando attributes, and performs operations necessary
for the role's compliance.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
checkMembership, propagateMembership, verifyPolicy
public void checkRoles(List<UserGroupRole> addUserGroupRoles, List<UserGroupRole> removeUserGroupRoles) throws PortalException
OrganizationMembershipPolicy
Liferay's core services call this method before adding the users to and removing the users from the respective organization roles. If this method throws an exception, the service foregoes making the changes.
checkRoles
in interface OrganizationMembershipPolicy
addUserGroupRoles
- the user group roles to be addedremoveUserGroupRoles
- the user group roles to be removedPortalException
public boolean isMembershipAllowed(long userId, long organizationId) throws PortalException
OrganizationMembershipPolicy
true
if the user can be added to the organization.
Liferay's UI calls this method.isMembershipAllowed
in interface OrganizationMembershipPolicy
userId
- the primary key of the userorganizationId
- the primary key of the organizationtrue
if the user can be added to the organization;
false
otherwisePortalException
public boolean isMembershipProtected(PermissionChecker permissionChecker, long userId, long organizationId) throws PortalException
OrganizationMembershipPolicy
true
if the policy prevents the user from being
removed from the organization by the user associated with the permission
checker.isMembershipProtected
in interface OrganizationMembershipPolicy
permissionChecker
- the permission checker referencing a useruserId
- the primary key of the user to check for protectionorganizationId
- the primary key of the organizationtrue
if the policy prevents the user from being
removed from the organization by the user associated with the
permission checker; false
otherwisePortalException
public boolean isMembershipRequired(long userId, long organizationId) throws PortalException
OrganizationMembershipPolicy
true
if organization membership for the user is
mandatory. Liferay's UI, for example, calls this method in deciding
whether to enable the checkbox for removing the user from the
organization.isMembershipRequired
in interface OrganizationMembershipPolicy
userId
- the primary key of the userorganizationId
- the primary key of the organizationtrue
if organization membership for the user is
mandatory; false
otherwisePortalException
public boolean isRoleAllowed(long userId, long organizationId, long roleId) throws PortalException
OrganizationMembershipPolicy
true
if the role can be added to the user on the
organization. Liferay's UI calls this method.isRoleAllowed
in interface OrganizationMembershipPolicy
userId
- the primary key of the userorganizationId
- the primary key of the organizationroleId
- the primary key of the roletrue
if the role can be added to the user on the
organization; false
otherwisePortalException
public boolean isRoleProtected(PermissionChecker permissionChecker, long userId, long organizationId, long roleId) throws PortalException
OrganizationMembershipPolicy
true
if the policy prevents the user from being
removed from the role by the user associated with the permission checker.isRoleProtected
in interface OrganizationMembershipPolicy
permissionChecker
- the permission checker referencing a useruserId
- the primary key of the user to check for protectionorganizationId
- the primary key of the organizationroleId
- the primary key of the roletrue
if the policy prevents the user from being
removed from the role by the user associated with the permission
checker; false
otherwisePortalException
public boolean isRoleRequired(long userId, long organizationId, long roleId) throws PortalException
OrganizationMembershipPolicy
true
if the role is mandatory for the user on the
organization. Liferay's UI calls this method.isRoleRequired
in interface OrganizationMembershipPolicy
userId
- the primary key of the userorganizationId
- the primary key of the organizationroleId
- the primary key of the roletrue
if the role is mandatory for the user on the
organization; false
otherwisePortalException
public void propagateRoles(List<UserGroupRole> addUserGroupRoles, List<UserGroupRole> removeUserGroupRoles)
OrganizationMembershipPolicy
The actions must ensure the membership policy of each organization role. For example, some actions for implementations to consider performing are:
propagateRoles
in interface OrganizationMembershipPolicy
addUserGroupRoles
- the user group roles addedremoveUserGroupRoles
- the user group roles removedpublic void verifyPolicy() throws PortalException
OrganizationMembershipPolicy
membership.policy.auto.verify
portal property is
true
this method is triggered when starting Liferay and
every time a membership policy hook is deployed.verifyPolicy
in interface OrganizationMembershipPolicy
PortalException
public void verifyPolicy(Organization organization) throws PortalException
OrganizationMembershipPolicy
verifyPolicy
in interface OrganizationMembershipPolicy
organization
- the organization to verifyPortalException
public void verifyPolicy(Role role)
OrganizationMembershipPolicy
verifyPolicy
in interface OrganizationMembershipPolicy
role
- the role to verifypublic void verifyPolicy(Role role, Role oldRole, Map<String,Serializable> oldExpandoAttributes)
OrganizationMembershipPolicy
verifyPolicy
in interface OrganizationMembershipPolicy
role
- the added or updated role to verifyoldRole
- the old roleoldExpandoAttributes
- the old expando attributes