Class BaseOrganizationMembershipPolicy
Object
com.liferay.portal.kernel.security.membershippolicy.BaseOrganizationMembershipPolicy
- All Implemented Interfaces:
OrganizationMembershipPolicy
- Direct Known Subclasses:
DummyOrganizationMembershipPolicy
public abstract class BaseOrganizationMembershipPolicy
extends Object
implements OrganizationMembershipPolicy
- Author:
- Roberto Díaz, Sergio González
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidcheckRoles(List<UserGroupRole> addUserGroupRoles, List<UserGroupRole> removeUserGroupRoles) Checks if the organization roles can be added to or removed from their users.booleanisMembershipAllowed(long userId, long organizationId) Returnstrueif the user can be added to the organization.booleanisMembershipProtected(PermissionChecker permissionChecker, long userId, long organizationId) Returnstrueif the policy prevents the user from being removed from the organization by the user associated with the permission checker.booleanisMembershipRequired(long userId, long organizationId) Returnstrueif organization membership for the user is mandatory.booleanisRoleAllowed(long userId, long organizationId, long roleId) Returnstrueif the role can be added to the user on the organization.booleanisRoleProtected(PermissionChecker permissionChecker, long userId, long organizationId, long roleId) Returnstrueif the policy prevents the user from being removed from the role by the user associated with the permission checker.booleanisRoleRequired(long userId, long organizationId, long roleId) Returnstrueif the role is mandatory for the user on the organization.voidpropagateRoles(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.voidChecks 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.voidverifyPolicy(Organization organization) Checks the integrity of the membership policy of the organization and performs operations necessary for the organization's compliance.voidverifyPolicy(Role role) Checks the integrity of the membership policy of the organization role and performs operations necessary for the role's compliance.voidverifyPolicy(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.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.liferay.portal.kernel.security.membershippolicy.OrganizationMembershipPolicy
checkMembership, propagateMembership, verifyPolicy
-
Constructor Details
-
BaseOrganizationMembershipPolicy
public BaseOrganizationMembershipPolicy()
-
-
Method Details
-
checkRoles
public void checkRoles(List<UserGroupRole> addUserGroupRoles, List<UserGroupRole> removeUserGroupRoles) throws PortalException Description copied from interface:OrganizationMembershipPolicyChecks if the organization 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 organization roles. If this method throws an exception, the service foregoes making the changes.
- Specified by:
checkRolesin interfaceOrganizationMembershipPolicy- Parameters:
addUserGroupRoles- the user group roles to be addedremoveUserGroupRoles- the user group roles to be removed- Throws:
PortalException
-
isMembershipAllowed
Description copied from interface:OrganizationMembershipPolicyReturnstrueif the user can be added to the organization. Liferay's UI calls this method.- Specified by:
isMembershipAllowedin interfaceOrganizationMembershipPolicy- Parameters:
userId- the primary key of the userorganizationId- the primary key of the organization- Returns:
trueif the user can be added to the organization;falseotherwise- Throws:
PortalException
-
isMembershipProtected
public boolean isMembershipProtected(PermissionChecker permissionChecker, long userId, long organizationId) throws PortalException Description copied from interface:OrganizationMembershipPolicyReturnstrueif the policy prevents the user from being removed from the organization by the user associated with the permission checker.- Specified by:
isMembershipProtectedin interfaceOrganizationMembershipPolicy- Parameters:
permissionChecker- the permission checker referencing a useruserId- the primary key of the user to check for protectionorganizationId- the primary key of the organization- Returns:
trueif the policy prevents the user from being removed from the organization by the user associated with the permission checker;falseotherwise- Throws:
PortalException
-
isMembershipRequired
Description copied from interface:OrganizationMembershipPolicyReturnstrueif 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.- Specified by:
isMembershipRequiredin interfaceOrganizationMembershipPolicy- Parameters:
userId- the primary key of the userorganizationId- the primary key of the organization- Returns:
trueif organization membership for the user is mandatory;falseotherwise- Throws:
PortalException
-
isRoleAllowed
Description copied from interface:OrganizationMembershipPolicyReturnstrueif the role can be added to the user on the organization. Liferay's UI calls this method.- Specified by:
isRoleAllowedin interfaceOrganizationMembershipPolicy- Parameters:
userId- the primary key of the userorganizationId- the primary key of the organizationroleId- the primary key of the role- Returns:
trueif the role can be added to the user on the organization;falseotherwise- Throws:
PortalException
-
isRoleProtected
public boolean isRoleProtected(PermissionChecker permissionChecker, long userId, long organizationId, long roleId) throws PortalException Description copied from interface:OrganizationMembershipPolicyReturnstrueif the policy prevents the user from being removed from the role by the user associated with the permission checker.- Specified by:
isRoleProtectedin interfaceOrganizationMembershipPolicy- Parameters:
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 role- Returns:
trueif the policy prevents the user from being removed from the role by the user associated with the permission checker;falseotherwise- Throws:
PortalException
-
isRoleRequired
Description copied from interface:OrganizationMembershipPolicyReturnstrueif the role is mandatory for the user on the organization. Liferay's UI calls this method.- Specified by:
isRoleRequiredin interfaceOrganizationMembershipPolicy- Parameters:
userId- the primary key of the userorganizationId- the primary key of the organizationroleId- the primary key of the role- Returns:
trueif the role is mandatory for the user on the organization;falseotherwise- Throws:
PortalException
-
propagateRoles
public void propagateRoles(List<UserGroupRole> addUserGroupRoles, List<UserGroupRole> removeUserGroupRoles) Description copied from interface:OrganizationMembershipPolicyPerforms membership policy related actions after the respective organization 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 organization 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.
- Specified by:
propagateRolesin interfaceOrganizationMembershipPolicy- Parameters:
addUserGroupRoles- the user group roles addedremoveUserGroupRoles- the user group roles removed
-
verifyPolicy
Description copied from interface:OrganizationMembershipPolicyChecks 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. This method can be triggered manually from the Control Panel. If themembership.policy.auto.verifyportal property istruethis method is triggered when starting Liferay and every time a membership policy hook is deployed.- Specified by:
verifyPolicyin interfaceOrganizationMembershipPolicy- Throws:
PortalException
-
verifyPolicy
Description copied from interface:OrganizationMembershipPolicyChecks the integrity of the membership policy of the organization and performs operations necessary for the organization's compliance.- Specified by:
verifyPolicyin interfaceOrganizationMembershipPolicy- Parameters:
organization- the organization to verify- Throws:
PortalException
-
verifyPolicy
Description copied from interface:OrganizationMembershipPolicyChecks the integrity of the membership policy of the organization role and performs operations necessary for the role's compliance.- Specified by:
verifyPolicyin interfaceOrganizationMembershipPolicy- Parameters:
role- the role to verify
-
verifyPolicy
Description copied from interface:OrganizationMembershipPolicyChecks 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. Liferay calls this method when adding and updating organization roles.- Specified by:
verifyPolicyin interfaceOrganizationMembershipPolicy- Parameters:
role- the added or updated role to verifyoldRole- the old roleoldExpandoAttributes- the old expando attributes
-