use of com.liferay.portal.security.permission.PermissionChecker in project liferay-ide by liferay.
the class SearchPortlet method getStatus.
protected int getStatus(RenderRequest renderRequest) throws Exception {
ThemeDisplay themeDisplay = (ThemeDisplay) renderRequest.getAttribute(WebKeys.THEME_DISPLAY);
if (!themeDisplay.isSignedIn()) {
return WorkflowConstants.STATUS_APPROVED;
}
String value = renderRequest.getParameter("status");
int status = GetterUtil.getInteger(value);
if ((value != null) && (status == WorkflowConstants.STATUS_APPROVED)) {
return WorkflowConstants.STATUS_APPROVED;
}
long resourcePrimKey = ParamUtil.getLong(renderRequest, "resourcePrimKey");
if (resourcePrimKey == 0) {
return WorkflowConstants.STATUS_APPROVED;
}
PermissionChecker permissionChecker = themeDisplay.getPermissionChecker();
if (KBArticlePermission.contains(permissionChecker, resourcePrimKey, ActionKeys.UPDATE)) {
return ParamUtil.getInteger(renderRequest, "status", WorkflowConstants.STATUS_ANY);
}
return WorkflowConstants.STATUS_APPROVED;
}
use of com.liferay.portal.security.permission.PermissionChecker in project liferay-ide by liferay.
the class SectionPortlet method getStatus.
protected int getStatus(RenderRequest renderRequest) throws Exception {
ThemeDisplay themeDisplay = (ThemeDisplay) renderRequest.getAttribute(WebKeys.THEME_DISPLAY);
if (!themeDisplay.isSignedIn()) {
return WorkflowConstants.STATUS_APPROVED;
}
String value = renderRequest.getParameter("status");
int status = GetterUtil.getInteger(value);
if ((value != null) && (status == WorkflowConstants.STATUS_APPROVED)) {
return WorkflowConstants.STATUS_APPROVED;
}
long resourcePrimKey = ParamUtil.getLong(renderRequest, "resourcePrimKey");
if (resourcePrimKey == 0) {
return WorkflowConstants.STATUS_APPROVED;
}
PermissionChecker permissionChecker = themeDisplay.getPermissionChecker();
if (KBArticlePermission.contains(permissionChecker, resourcePrimKey, ActionKeys.UPDATE)) {
return ParamUtil.getInteger(renderRequest, "status", WorkflowConstants.STATUS_ANY);
}
return WorkflowConstants.STATUS_APPROVED;
}
use of com.liferay.portal.security.permission.PermissionChecker in project liferay-ide by liferay.
the class AdminSubscriptionSender method hasPermission.
@Override
protected boolean hasPermission(Subscription subscription, String inferredClassName, long inferredClassPK, User user) throws Exception {
String name = PrincipalThreadLocal.getName();
PermissionChecker contextPermissionChecker = PermissionThreadLocal.getPermissionChecker();
try {
PrincipalThreadLocal.setName(user.getUserId());
PermissionChecker permissionChecker = PermissionCheckerFactoryUtil.create(user);
PermissionThreadLocal.setPermissionChecker(permissionChecker);
return KBArticlePermission.contains(permissionChecker, _kbArticle, ActionKeys.VIEW);
} finally {
PrincipalThreadLocal.setName(name);
PermissionThreadLocal.setPermissionChecker(contextPermissionChecker);
}
}
use of com.liferay.portal.security.permission.PermissionChecker in project liferay-ide by liferay.
the class ArticlePortlet method getStatus.
protected int getStatus(RenderRequest renderRequest) throws Exception {
ThemeDisplay themeDisplay = (ThemeDisplay) renderRequest.getAttribute(WebKeys.THEME_DISPLAY);
if (!themeDisplay.isSignedIn()) {
return WorkflowConstants.STATUS_APPROVED;
}
String value = renderRequest.getParameter("status");
int status = GetterUtil.getInteger(value);
if ((value != null) && (status == WorkflowConstants.STATUS_APPROVED)) {
return WorkflowConstants.STATUS_APPROVED;
}
long resourcePrimKey = getResourcePrimKey(renderRequest);
if (resourcePrimKey == 0) {
return WorkflowConstants.STATUS_APPROVED;
}
PermissionChecker permissionChecker = themeDisplay.getPermissionChecker();
if (KBArticlePermission.contains(permissionChecker, resourcePrimKey, ActionKeys.UPDATE)) {
return ParamUtil.getInteger(renderRequest, "status", WorkflowConstants.STATUS_ANY);
}
return WorkflowConstants.STATUS_APPROVED;
}
use of com.liferay.portal.security.permission.PermissionChecker in project liferay-ide by liferay.
the class AdminPortlet method updateOAuthConsumers.
public void updateOAuthConsumers(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception {
ThemeDisplay themeDisplay = (ThemeDisplay) actionRequest.getAttribute(WebKeys.THEME_DISPLAY);
PermissionChecker permissionChecker = themeDisplay.getPermissionChecker();
long gadgetId = ParamUtil.getLong(actionRequest, "gadgetId");
GadgetPermission.check(permissionChecker, themeDisplay.getScopeGroupId(), gadgetId, ActionKeys.UPDATE);
ShindigUtil.updateOAuthConsumers(actionRequest, actionResponse);
}
Aggregations