留言板

Service builder not generating filterFindBy methods

Pierre Roukens,修改在8 年前。

Service builder not generating filterFindBy methods

New Member 帖子: 20 加入日期: 14-1-19 最近的帖子
Hi all,

I'm using permissions checks and have defined portlet and model permissions. When I put these directly in /resource-actions/default.xml, all works as expected Service builder generates filterFindBy methods in the persistence service. But, when I create separate xml files to put the resource actions in, and use "<resource file="resource-actions/.....xml" />" in default.xml, and build the service layer, no filterFindBy methods are created?!

Am I doing something wrong or is this a bug?
thumbnail
Jan Geißler,修改在8 年前。

RE: Service builder not generating filterFindBy methods

Liferay Master 帖子: 735 加入日期: 11-7-5 最近的帖子
Which Portal version are you using?
Pierre Roukens,修改在8 年前。

RE: Service builder not generating filterFindBy methods

New Member 帖子: 20 加入日期: 14-1-19 最近的帖子
Hi Jan,

Thanks for your response! I'm using CE 6.2 GA4.

Regards,
Pierre
thumbnail
Jan Geißler,修改在8 年前。

RE: Service builder not generating filterFindBy methods

Liferay Master 帖子: 735 加入日期: 11-7-5 最近的帖子
And you are talking about the filterFindBy methods which you have defined in the Service.xml, right? If so, please verify this behavior and you should open a bug. In my mind, the resource permissions should not impact the findBy methods.
Pierre Roukens,修改在8 年前。

RE: Service builder not generating filterFindBy methods

New Member 帖子: 20 加入日期: 14-1-19 最近的帖子
The filterFindBy methods are created by servicebuilder. See Permission filtering on the service builder wiki page.
Finder methods are created automatically but these will return all the results. FilterFindBy method can also be generated under certain conditions and they will return the results filtered by permissions. The conditions are:
1. the entity has a simple primitive pk
2. the entity has permission checke registered in resource-actions/....xml
3. the entity has user id an group id fields
4. the finder method has group id in it

These are created when putting all permission settings in default.xml but not when I use includes.
thumbnail
Jan Geißler,修改在8 年前。

RE: Service builder not generating filterFindBy methods

Liferay Master 帖子: 735 加入日期: 11-7-5 最近的帖子
Ahh yes, Definitely a bug in my mind. I am assuming all the prerequisites are met. Also 2. clearly states that the permission checks should als be considered if you have different files for different entities.
Pierre Roukens,修改在8 年前。

RE: Service builder not generating filterFindBy methods

New Member 帖子: 20 加入日期: 14-1-19 最近的帖子
Yes, all prerequisites are met. And the methods are created when only using default.xml.
Created issue LPS-56028 for this.
Thanks Jan!
thumbnail
Jan Geißler,修改在8 年前。

RE: Service builder not generating filterFindBy methods

Liferay Master 帖子: 735 加入日期: 11-7-5 最近的帖子
Well at least you have a workaround, even if its not the clean and modularized way of doing things ; )
thumbnail
Philipp Schwarz,修改在8 年前。

RE: Service builder not generating filterFindBy methods

Junior Member 帖子: 29 加入日期: 12-10-19 最近的帖子
Thank you so much Pierre, this just saved me a lot of time!

I'm on 6.1.1 CE GA2 and it behaves exactly the same.

Cheers,
Phil