com.liferay.portlet.rolesadmin.search.ResourceActionRowChecker 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.portlet.rolesadmin.search;
import com.liferay.portal.kernel.dao.search.RowChecker;
import com.liferay.portal.kernel.log.Log;
import com.liferay.portal.kernel.log.LogFactoryUtil;
import com.liferay.portal.kernel.model.Role;
import com.liferay.portal.kernel.service.ResourcePermissionLocalServiceUtil;
import javax.portlet.PortletResponse;
/**
* @author Jorge Ferrer
* @author Connor McKay
*/
public class ResourceActionRowChecker extends RowChecker {
public ResourceActionRowChecker(PortletResponse portletResponse) {
super(portletResponse);
}
@Override
public boolean isChecked(Object object) {
try {
return doIsChecked(object);
}
catch (Exception exception) {
if (_log.isDebugEnabled()) {
_log.debug(exception);
}
return false;
}
}
protected boolean doIsChecked(Object object) throws Exception {
Object[] objArray = (Object[])object;
Role role = (Role)objArray[0];
String actionId = (String)objArray[1];
String resourceName = (String)objArray[2];
Integer scope = (Integer)objArray[4];
return ResourcePermissionLocalServiceUtil.hasScopeResourcePermission(
role.getCompanyId(), resourceName, scope, role.getRoleId(),
actionId);
}
private static final Log _log = LogFactoryUtil.getLog(
ResourceActionRowChecker.class);
} © 2015 - 2025 Weber Informatics LLC | Privacy Policy