All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.liferay.segments.web.internal.security.permission.resource.SegmentsResourcePermission Maven / Gradle / Ivy

The newest version!
/**
 * SPDX-FileCopyrightText: (c) 2000 Liferay, Inc. https://liferay.com
 * SPDX-License-Identifier: LGPL-2.1-or-later OR LicenseRef-Liferay-DXP-EULA-2.0.0-2023-06
 */

package com.liferay.segments.web.internal.security.permission.resource;

import com.liferay.portal.kernel.module.service.Snapshot;
import com.liferay.portal.kernel.security.auth.PrincipalException;
import com.liferay.portal.kernel.security.permission.PermissionChecker;
import com.liferay.portal.kernel.security.permission.resource.PortletResourcePermission;
import com.liferay.segments.constants.SegmentsConstants;

/**
 * @author Eduardo García
 */
public class SegmentsResourcePermission {

	public static void check(
			PermissionChecker permissionChecker, long scopeGroupId,
			String actionId)
		throws PrincipalException {

		PortletResourcePermission portletResourcePermission =
			_portletResourcePermissionSnapshot.get();

		portletResourcePermission.check(
			permissionChecker, scopeGroupId, actionId);
	}

	public static boolean contains(
		PermissionChecker permissionChecker, long groupId, String actionId) {

		PortletResourcePermission portletResourcePermission =
			_portletResourcePermissionSnapshot.get();

		return portletResourcePermission.contains(
			permissionChecker, groupId, actionId);
	}

	private static final Snapshot
		_portletResourcePermissionSnapshot = new Snapshot<>(
			SegmentsResourcePermission.class, PortletResourcePermission.class,
			"(resource.name=" + SegmentsConstants.RESOURCE_NAME + ")");

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy