留言板

Using core liferay permission helper classes in custom portlets

thumbnail
Alain Dresse,修改在10 年前。

Using core liferay permission helper classes in custom portlets

Junior Member 帖子: 95 加入日期: 11-7-18 最近的帖子
The Liferay developer documentation recommends writing and user permission helper classes such as BlogsPermission.

When I try to use it in a portlet class, I get a 'java.lang.ClassNotFoundException. Hence the question: how can I user permission helpers in a custom portlet ?

Thanks,
Alain

PS: this question was also posted on stackoverflow.
thumbnail
Ahmed Hasan,修改在10 年前。

RE: Using core liferay permission helper classes in custom portlets

Expert 帖子: 306 加入日期: 07-4-13 最近的帖子
Hi Alain,

I have covered this aspect of using a custom permission class in a custom portlet in my FREE eBook on Liferay Portlet Development. You can download a free copy and refer to that relevant chapter. Please feel free to get in touch with me if you still have this problem.

Yours truly,
Ahamed Hasan
Author, Liferay Portlet Cookbook
thumbnail
Alain Dresse,修改在10 年前。

RE: Using core liferay permission helper classes in custom portlets

Junior Member 帖子: 95 加入日期: 11-7-18 最近的帖子
Thank you Ahamed,

I downloaded your book (quite a contribution to the Liferay community !).
I see how to create and use a permission helper class for my own portlet, but I don't see how to use the permission helper class for the core liferay classes. Please take a look at the additional information I put in my corresponding question on StackOverflow.

Best regards,
Alain
thumbnail
Harish Kumar,修改在10 年前。

RE: Using core liferay permission helper classes in custom portlets

Expert 帖子: 483 加入日期: 10-7-31 最近的帖子
Hi Alain

As mentioned in Liferay Documentation,

Helper classes streamline your code. They encapsulate the use of permissionChecker and the names of the resources for a specific portlet. 


Further they are part of portal-impl package, so can't use these in your custom portlet directly.
thumbnail
Alain Dresse,修改在10 年前。

RE: Using core liferay permission helper classes in custom portlets

Junior Member 帖子: 95 加入日期: 11-7-18 最近的帖子
Harish,

Thanks for confirming that the core class permission helpers are not accessible from custom portlets.

I am struggling to understand why. My understanding is that this triggers duplicate code if one copy-pastes the logic from the core helper classes. Bypassing the copy and going directly to the lower level checks leaves aside valuable checks (such as staging permissions).

Best regards,
Alain
thumbnail
David H Nebinger,修改在10 年前。

RE: Using core liferay permission helper classes in custom portlets

Liferay Legend 帖子: 14919 加入日期: 06-9-2 最近的帖子
I think it came down to not being able to move them to the portal-service.jar file unless a bunch of other classes (ones that shouldn't be exposed) got moved also.
thumbnail
Alain Dresse,修改在10 年前。

RE: Using core liferay permission helper classes in custom portlets

Junior Member 帖子: 95 加入日期: 11-7-18 最近的帖子
Thanks for the background info !
Alain