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

com.liferay.notification.internal.security.permission.resource.NotificationQueueEntryPortletResourcePermissionWrapper Maven / Gradle / Ivy

There is a newer version: 1.0.83
Show 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.notification.internal.security.permission.resource;

import com.liferay.notification.constants.NotificationConstants;
import com.liferay.portal.kernel.model.Group;
import com.liferay.portal.kernel.security.permission.PermissionChecker;
import com.liferay.portal.kernel.security.permission.resource.BasePortletResourcePermissionWrapper;
import com.liferay.portal.kernel.security.permission.resource.PortletResourcePermission;
import com.liferay.portal.kernel.security.permission.resource.PortletResourcePermissionFactory;
import com.liferay.portal.kernel.security.permission.resource.PortletResourcePermissionLogic;

import org.osgi.service.component.annotations.Component;

/**
 * @author Murilo Stodolni
 */
@Component(
	property = "resource.name=" + NotificationConstants.RESOURCE_NAME_NOTIFICATION_QUEUE,
	service = PortletResourcePermission.class
)
public class NotificationQueueEntryPortletResourcePermissionWrapper
	extends BasePortletResourcePermissionWrapper {

	@Override
	protected PortletResourcePermission doGetPortletResourcePermission() {
		return PortletResourcePermissionFactory.create(
			NotificationConstants.RESOURCE_NAME_NOTIFICATION_QUEUE,
			new NotificationQueueEntryPortletResourcePermissionLogic());
	}

	private static class NotificationQueueEntryPortletResourcePermissionLogic
		implements PortletResourcePermissionLogic {

		@Override
		public Boolean contains(
			PermissionChecker permissionChecker, String name, Group group,
			String actionId) {

			if (permissionChecker.hasPermission(group, name, 0, actionId)) {
				return true;
			}

			return false;
		}

	}

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy