Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
/**
* Copyright (c) 2000-present 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.service.permission;
import com.liferay.petra.lang.HashUtil;
import com.liferay.portal.kernel.exception.PortalException;
import com.liferay.portal.kernel.model.Group;
import com.liferay.portal.kernel.model.GroupConstants;
import com.liferay.portal.kernel.model.User;
import com.liferay.portal.kernel.security.auth.PrincipalException;
import com.liferay.portal.kernel.security.permission.ActionKeys;
import com.liferay.portal.kernel.security.permission.BaseModelPermissionChecker;
import com.liferay.portal.kernel.security.permission.PermissionChecker;
import com.liferay.portal.kernel.service.GroupLocalServiceUtil;
import com.liferay.portal.kernel.service.UserLocalServiceUtil;
import com.liferay.portal.kernel.service.permission.GroupPermission;
import com.liferay.portal.kernel.service.permission.PortalPermissionUtil;
import com.liferay.portal.kernel.service.permission.UserPermissionUtil;
import com.liferay.portal.kernel.spring.osgi.OSGiBeanProperties;
import com.liferay.portal.util.PropsValues;
import java.util.Map;
import java.util.Objects;
/**
* @author Brian Wing Shun Chan
* @author Raymond Augé
*/
@OSGiBeanProperties(
property = "model.class.name=com.liferay.portal.kernel.model.Group"
)
public class GroupPermissionImpl
implements BaseModelPermissionChecker, GroupPermission {
@Override
public void check(
PermissionChecker permissionChecker, Group group, String actionId)
throws PortalException {
if (!contains(permissionChecker, group, actionId)) {
throw new PrincipalException.MustHavePermission(
permissionChecker, Group.class.getName(), group.getGroupId(),
actionId);
}
}
@Override
public void check(
PermissionChecker permissionChecker, long groupId, String actionId)
throws PortalException {
if (!contains(permissionChecker, groupId, actionId)) {
throw new PrincipalException.MustHavePermission(
permissionChecker, Group.class.getName(), groupId, actionId);
}
}
@Override
public void check(PermissionChecker permissionChecker, String actionId)
throws PortalException {
if (!contains(permissionChecker, actionId)) {
throw new PrincipalException.MustHavePermission(
permissionChecker, Group.class.getName(), Long.valueOf(0),
actionId);
}
}
@Override
public void checkBaseModel(
PermissionChecker permissionChecker, long groupId, long primaryKey,
String actionId)
throws PortalException {
check(permissionChecker, primaryKey, actionId);
}
@Override
public boolean contains(
PermissionChecker permissionChecker, Group group, String actionId)
throws PortalException {
Map