com.liferay.depot.internal.security.permission.wrapper.PermissionCheckerFactoryImpl Maven / Gradle / Ivy
/**
* 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.depot.internal.security.permission.wrapper;
import com.liferay.depot.configuration.DepotConfiguration;
import com.liferay.depot.model.DepotEntry;
import com.liferay.portal.kernel.security.permission.PermissionChecker;
import com.liferay.portal.kernel.security.permission.resource.ModelResourcePermission;
import com.liferay.portal.kernel.security.permission.wrapper.PermissionCheckerWrapperFactory;
import com.liferay.portal.kernel.service.GroupLocalService;
import com.liferay.portal.kernel.service.RoleLocalService;
import com.liferay.portal.kernel.service.UserGroupRoleLocalService;
import org.osgi.service.component.annotations.Component;
import org.osgi.service.component.annotations.Reference;
/**
* @author Cristina Gonzálaez
*/
@Component(
property = "service.ranking:Integer=100",
service = PermissionCheckerWrapperFactory.class
)
public class PermissionCheckerFactoryImpl
implements PermissionCheckerWrapperFactory {
@Override
public PermissionChecker wrapPermissionChecker(
PermissionChecker permissionChecker) {
if (!_depotConfiguration.isEnabled()) {
return permissionChecker;
}
return new DepotPermissionCheckerWrapper(
permissionChecker, _depotEntryModelResourcePermission,
_groupLocalService, _roleLocalService, _userGroupRoleLocalService);
}
@Reference
private DepotConfiguration _depotConfiguration;
@Reference(target = "(model.class.name=com.liferay.depot.model.DepotEntry)")
private ModelResourcePermission
_depotEntryModelResourcePermission;
@Reference
private GroupLocalService _groupLocalService;
@Reference
private RoleLocalService _roleLocalService;
@Reference
private UserGroupRoleLocalService _userGroupRoleLocalService;
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy