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

com.liferay.document.library.internal.security.permission.resource.FolderModelResourcePermissionWrapper Maven / Gradle / Ivy

There is a newer version: 6.0.134
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.document.library.internal.security.permission.resource;

import com.liferay.document.library.kernel.service.DLAppLocalService;
import com.liferay.portal.kernel.repository.model.Folder;
import com.liferay.portal.kernel.security.permission.resource.BaseModelResourcePermissionWrapper;
import com.liferay.portal.kernel.security.permission.resource.ModelResourcePermission;
import com.liferay.portal.kernel.security.permission.resource.ModelResourcePermissionFactory;
import com.liferay.portal.kernel.security.permission.resource.PortletResourcePermission;
import com.liferay.portlet.documentlibrary.constants.DLConstants;

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

/**
 * @author Preston Crary
 */
@Component(
	property = "model.class.name=com.liferay.portal.kernel.repository.model.Folder",
	service = ModelResourcePermission.class
)
public class FolderModelResourcePermissionWrapper
	extends BaseModelResourcePermissionWrapper {

	@Override
	protected ModelResourcePermission doGetModelResourcePermission() {
		return ModelResourcePermissionFactory.create(
			Folder.class, Folder::getFolderId, _dlAppLocalService::getFolder,
			_portletResourcePermission,
			(modelResourcePermission, consumer) -> consumer.accept(
				(permissionChecker, name, folder, actionId) ->
					folder.containsPermission(permissionChecker, actionId)));
	}

	@Reference
	private DLAppLocalService _dlAppLocalService;

	@Reference(target = "(resource.name=" + DLConstants.RESOURCE_NAME + ")")
	private PortletResourcePermission _portletResourcePermission;

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy