com.liferay.portal.security.membershippolicy.SiteMembershipPolicyUtil Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of portal-service Show documentation
Show all versions of portal-service Show documentation
Contains interfaces for the portal services. Interfaces are only loaded by the global class loader and are shared by all plugins.
/**
* Copyright (c) 2000-2013 Liferay, Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or modify it under
* the terms of the GNU Lesser General Public License as published by the Free
* Software Foundation; either version 2.1 of the License, or (at your option)
* any later version.
*
* This library is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
* details.
*/
package com.liferay.portal.security.membershippolicy;
import com.liferay.portal.kernel.exception.PortalException;
import com.liferay.portal.kernel.exception.SystemException;
import com.liferay.portal.kernel.util.UnicodeProperties;
import com.liferay.portal.model.Group;
import com.liferay.portal.model.Role;
import com.liferay.portal.model.UserGroupRole;
import com.liferay.portal.security.permission.PermissionChecker;
import com.liferay.portlet.asset.model.AssetCategory;
import com.liferay.portlet.asset.model.AssetTag;
import java.io.Serializable;
import java.util.List;
import java.util.Map;
/**
* @author Roberto Díaz
* @author Sergio González
*/
public class SiteMembershipPolicyUtil {
public static void checkMembership(
long[] userIds, long[] addGroupIds, long[] removeGroupIds)
throws PortalException, SystemException {
SiteMembershipPolicy siteMembershipPolicy =
SiteMembershipPolicyFactoryUtil.getSiteMembershipPolicy();
siteMembershipPolicy.checkMembership(
userIds, addGroupIds, removeGroupIds);
}
public static void checkRoles(
List addUserGroupRoles,
List removeUserGroupRoles)
throws PortalException, SystemException {
SiteMembershipPolicy siteMembershipPolicy =
SiteMembershipPolicyFactoryUtil.getSiteMembershipPolicy();
siteMembershipPolicy.checkRoles(
addUserGroupRoles, removeUserGroupRoles);
}
public static boolean isMembershipAllowed(long userId, long groupId)
throws PortalException, SystemException {
SiteMembershipPolicy siteMembershipPolicy =
SiteMembershipPolicyFactoryUtil.getSiteMembershipPolicy();
return siteMembershipPolicy.isMembershipAllowed(userId, groupId);
}
public static boolean isMembershipProtected(
PermissionChecker permissionChecker, long userId, long groupId)
throws PortalException, SystemException {
SiteMembershipPolicy siteMembershipPolicy =
SiteMembershipPolicyFactoryUtil.getSiteMembershipPolicy();
return siteMembershipPolicy.isMembershipProtected(
permissionChecker, userId, groupId);
}
public static boolean isMembershipRequired(long userId, long groupId)
throws PortalException, SystemException {
SiteMembershipPolicy siteMembershipPolicy =
SiteMembershipPolicyFactoryUtil.getSiteMembershipPolicy();
return siteMembershipPolicy.isMembershipRequired(userId, groupId);
}
public static boolean isRoleAllowed(long userId, long groupId, long roleId)
throws PortalException, SystemException {
SiteMembershipPolicy siteMembershipPolicy =
SiteMembershipPolicyFactoryUtil.getSiteMembershipPolicy();
return siteMembershipPolicy.isRoleAllowed(userId, groupId, roleId);
}
public static boolean isRoleProtected(
PermissionChecker permissionChecker, long userId, long groupId,
long roleId)
throws PortalException, SystemException {
SiteMembershipPolicy siteMembershipPolicy =
SiteMembershipPolicyFactoryUtil.getSiteMembershipPolicy();
return siteMembershipPolicy.isRoleProtected(
permissionChecker, userId, groupId, roleId);
}
public static boolean isRoleRequired(long userId, long groupId, long roleId)
throws PortalException, SystemException {
SiteMembershipPolicy siteMembershipPolicy =
SiteMembershipPolicyFactoryUtil.getSiteMembershipPolicy();
return siteMembershipPolicy.isRoleRequired(userId, groupId, roleId);
}
public static void propagateMembership(
long[] userIds, long[] addGroupIds, long[] removeGroupIds)
throws PortalException, SystemException {
SiteMembershipPolicy siteMembershipPolicy =
SiteMembershipPolicyFactoryUtil.getSiteMembershipPolicy();
siteMembershipPolicy.propagateMembership(
userIds, addGroupIds, removeGroupIds);
}
public static void propagateRoles(
List addUserGroupRoles,
List removeUserGroupRoles)
throws PortalException, SystemException {
SiteMembershipPolicy siteMembershipPolicy =
SiteMembershipPolicyFactoryUtil.getSiteMembershipPolicy();
siteMembershipPolicy.propagateRoles(
addUserGroupRoles, removeUserGroupRoles);
}
public static void verifyPolicy() throws PortalException, SystemException {
SiteMembershipPolicy siteMembershipPolicy =
SiteMembershipPolicyFactoryUtil.getSiteMembershipPolicy();
siteMembershipPolicy.verifyPolicy();
}
public static void verifyPolicy(Group group)
throws PortalException, SystemException {
SiteMembershipPolicy siteMembershipPolicy =
SiteMembershipPolicyFactoryUtil.getSiteMembershipPolicy();
siteMembershipPolicy.verifyPolicy(group);
}
public static void verifyPolicy(
Group group, Group oldGroup, List oldAssetCategories,
List oldAssetTags,
Map oldExpandoAttributes,
UnicodeProperties oldTypeSettingsProperties)
throws PortalException, SystemException {
SiteMembershipPolicy siteMembershipPolicy =
SiteMembershipPolicyFactoryUtil.getSiteMembershipPolicy();
siteMembershipPolicy.verifyPolicy(
group, oldGroup, oldAssetCategories, oldAssetTags,
oldExpandoAttributes, oldTypeSettingsProperties);
}
public static void verifyPolicy(Role role)
throws PortalException, SystemException {
SiteMembershipPolicy siteMembershipPolicy =
SiteMembershipPolicyFactoryUtil.getSiteMembershipPolicy();
siteMembershipPolicy.verifyPolicy(role);
}
public static void verifyPolicy(
Role role, Role oldRole,
Map oldExpandoAttributes)
throws PortalException, SystemException {
SiteMembershipPolicy siteMembershipPolicy =
SiteMembershipPolicyFactoryUtil.getSiteMembershipPolicy();
siteMembershipPolicy.verifyPolicy(role, oldRole, oldExpandoAttributes);
}
}