Fórumok

Problems checking ADD_ARTICLE permissions

Joris Meijer, módosítva 10 év-val korábban

Problems checking ADD_ARTICLE permissions

New Member Bejegyzések: 11 Csatlakozás dátuma: 2013.06.04. Legújabb bejegyzések
Hi there,

I am using this method to check permissions to update a journal article (slight change of the example). However, I would also like to check if a user can add webcontent. When I refer to portal-impl/src/resource-actions/journal.xml I see that for ADD_ARTICLE a reference is made to a model with name "com.liferay.portlet.journal", but there is no such thing as a "JournalModel".

(How) can I use the method described in the link above to check if a user can add web content to a site specified by a certain groupid ?

I also tried this:

PortletPermissionUtil.check(permissionChecker,globalGroupId,PortletKeys.JOURNAL,ActionKeys.ADD_ARTICLE), but it gives me:

[http-bio-8080-exec-44][AdvancedPermissionChecker:966] com.liferay.portal.NoSuchResourceActionException: 15#ADD_ARTICLE
com.liferay.portal.NoSuchResourceActionException: 15#ADD_ARTICLE

thanks in advance for any hints.

Joris
thumbnail
Zsigmond Rab, módosítva 10 év-val korábban

RE: Problems checking ADD_ARTICLE permissions

Liferay Master Bejegyzések: 728 Csatlakozás dátuma: 2010.01.05. Legújabb bejegyzések
Hi Joris,

have you checked how it's done in the Web Content (Journal) portlet already?

Regards,
Zsigmond
Umasankar Jeyaraj, módosítva 10 év-val korábban

RE: Problems checking ADD_ARTICLE permissions

New Member Bejegyzések: 7 Csatlakozás dátuma: 2013.07.16. Legújabb bejegyzések
Hi Joris,
Did you find any solution for com.liferay.portal.NoSuchResourceActionException: 15#ADD_ARTICLE error. I am having the same requirement and getting this error
Joris Meijer, módosítva 10 év-val korábban

RE: Problems checking ADD_ARTICLE permissions

New Member Bejegyzések: 11 Csatlakozás dátuma: 2013.06.04. Legújabb bejegyzések
Hi Umasankar,

I followd Zsigmond's advice and checked the Web Content portlet out emoticon. Here is how I implemented it:

I copied JournalPermission into one of our own packages and included it in my JSP. I had to copy it because it's in the portal-impl package.

In my JSP:

<%
     ThemeDisplay themeDisplay = (ThemeDisplay)request.getAttribute(WebKeys.THEME_DISPLAY);
     PermissionChecker permissionChecker = themeDisplay.getPermissionChecker();
%>

<c:if test="<%= JournalPermission.contains(permissionChecker, themeDisplay.getCompany().getGroup().getGroupId(), ActionKeys.ADD_ARTICLE)%>">
   // display link to add_article struts action
</c:if>