Liferay 6.2-ce-ga5

com.liferay.portal.security.membershippolicy
Class DefaultSiteMembershipPolicy

java.lang.Object
  extended by com.liferay.portal.security.membershippolicy.BaseSiteMembershipPolicy
      extended by com.liferay.portal.security.membershippolicy.DefaultSiteMembershipPolicy
All Implemented Interfaces:
SiteMembershipPolicy

public class DefaultSiteMembershipPolicy
extends BaseSiteMembershipPolicy


Field Summary
static int DELETE_INTERVAL
           
 
Constructor Summary
DefaultSiteMembershipPolicy()
           
 
Method Summary
protected  void checkAddUsersLimitedGroup(long[] userIds, long[] groupIds)
           
 void checkMembership(long[] userIds, long[] addGroupIds, long[] removeGroupIds)
          Checks if the users can be added to and removed from the respective sites.
protected  List<Group> getLimitedChildrenGroups(Group group)
           
 boolean isMembershipAllowed(long userId, long groupId)
          Returns true if the user can be added to the site.
 void propagateMembership(long[] userIds, long[] addGroupIds, long[] removeGroupIds)
          Performs membership policy related actions after the users are added to and removed from the respective sites.
protected  void removeUsersFromLimitedChildrenGroups(long[] userIds, long groupId)
           
protected  void verifyLimitedParentMembership(Group group)
           
 void verifyPolicy(Group group)
          Checks the integrity of the membership policy of the site and performs operations necessary for the site's compliance.
 void verifyPolicy(Group group, Group oldGroup, List<AssetCategory> oldAssetCategories, List<AssetTag> oldAssetTags, Map<String,Serializable> oldExpandoAttributes, UnicodeProperties oldTypeSettingsProperties)
          Checks the integrity of the membership policy of the site, with respect to the site's new attribute values, categories, tags, expando attributes, and type settings properties, and performs operations necessary for the compliance of the site and its site roles.
 
Methods inherited from class com.liferay.portal.security.membershippolicy.BaseSiteMembershipPolicy
checkRoles, isMembershipProtected, isMembershipRequired, isRoleAllowed, isRoleProtected, isRoleRequired, propagateRoles, verifyPolicy, verifyPolicy, verifyPolicy
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DELETE_INTERVAL

public static final int DELETE_INTERVAL
See Also:
Constant Field Values
Constructor Detail

DefaultSiteMembershipPolicy

public DefaultSiteMembershipPolicy()
Method Detail

checkMembership

public void checkMembership(long[] userIds,
                            long[] addGroupIds,
                            long[] removeGroupIds)
                     throws PortalException,
                            SystemException
Description copied from interface: SiteMembershipPolicy
Checks if the users can be added to and removed from the respective sites.

Liferay's core services call this method before adding the users to and removing the users from the respective sites. 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 sites
addGroupIds - the primary keys of the sites to which the users are to be added (optionally null)
removeGroupIds - the primary keys of the sites from which the users are to be removed (optionally null)
Throws:
PortalException - if any one user could not be added to a site, if any one user could not be removed from a site, or if a portal exception occurred
SystemException - if a system exception occurred

isMembershipAllowed

public boolean isMembershipAllowed(long userId,
                                   long groupId)
Description copied from interface: SiteMembershipPolicy
Returns true if the user can be added to the site. Liferay's UI calls this method.

Specified by:
isMembershipAllowed in interface SiteMembershipPolicy
Overrides:
isMembershipAllowed in class BaseSiteMembershipPolicy
Parameters:
userId - the primary key of the user
groupId - the primary key of the site
Returns:
true if the user can be added to the site; false otherwise

propagateMembership

public void propagateMembership(long[] userIds,
                                long[] addGroupIds,
                                long[] removeGroupIds)
                         throws PortalException,
                                SystemException
Description copied from interface: SiteMembershipPolicy
Performs membership policy related actions after the users are added to and removed from the respective sites. Liferay's core services call this method after adding and removing the users to and from the respective sites.

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

Parameters:
userIds - the primary key of the users that have been added or removed
addGroupIds - the primary keys of the sites to which the users were added (optionally null)
removeGroupIds - the primary keys of the sites from which the users were removed (optionally null)
Throws:
PortalException - if a portal exception occurred
SystemException - if a system exception occurred

verifyPolicy

public void verifyPolicy(Group group)
                  throws PortalException,
                         SystemException
Description copied from interface: SiteMembershipPolicy
Checks the integrity of the membership policy of the site and performs operations necessary for the site's compliance.

Specified by:
verifyPolicy in interface SiteMembershipPolicy
Overrides:
verifyPolicy in class BaseSiteMembershipPolicy
Parameters:
group - the site to verify
Throws:
PortalException - if a portal exception occurred
SystemException - if a system exception occurred

verifyPolicy

public void verifyPolicy(Group group,
                         Group oldGroup,
                         List<AssetCategory> oldAssetCategories,
                         List<AssetTag> oldAssetTags,
                         Map<String,Serializable> oldExpandoAttributes,
                         UnicodeProperties oldTypeSettingsProperties)
                  throws PortalException,
                         SystemException
Description copied from interface: SiteMembershipPolicy
Checks the integrity of the membership policy of the site, with respect to the site's new attribute values, categories, tags, expando attributes, and type settings properties, and performs operations necessary for the compliance of the site and its site roles. Liferay calls this method when adding and updating sites.

The actions must ensure the integrity of the site's membership policy based on what has changed in the site's attribute values, categories, tags, expando attributes, and type settings properties.

For example, if the membership policy is that sites with the "admnistrator" tag should only allow administrators as users, then this method could enforce that policy using the following logic:


checkAddUsersLimitedGroup

protected void checkAddUsersLimitedGroup(long[] userIds,
                                         long[] groupIds)
                                  throws PortalException,
                                         SystemException
Throws:
PortalException
SystemException

getLimitedChildrenGroups

protected List<Group> getLimitedChildrenGroups(Group group)
                                        throws PortalException,
                                               SystemException
Throws:
PortalException
SystemException

removeUsersFromLimitedChildrenGroups

protected void removeUsersFromLimitedChildrenGroups(long[] userIds,
                                                    long groupId)
                                             throws PortalException,
                                                    SystemException
Throws:
PortalException
SystemException

verifyLimitedParentMembership

protected void verifyLimitedParentMembership(Group group)
                                      throws PortalException,
                                             SystemException
Throws:
PortalException
SystemException

Liferay 6.2-ce-ga5