掲示板

Liferay Portlet Admin Config Dialogue

thumbnail
7年前 に darren rose によって更新されました。

Liferay Portlet Admin Config Dialogue

Regular Member 投稿: 215 参加年月日: 15/04/04 最新の投稿
Support AND and NOT logic when determining when a Portlet is visible - currently only OR logic is supported so if user has role A or role B etc then the portlet is visible. adding support for logic AND and not is what we need.
thumbnail
7年前 に David H Nebinger によって更新されました。

RE: Liferay Portlet Admin Config Dialogue

Liferay Legend 投稿: 14919 参加年月日: 06/09/02 最新の投稿
You can likely emulate this using audience targeting and/or drools.

In general, though, you have to remember that this kind of logic adds time to page loads. When complicated logic is added into page rendering, render times increase and that cost may not be worth the extra complexity.
thumbnail
7年前 に darren rose によって更新されました。

RE: Liferay Portlet Admin Config Dialogue

Regular Member 投稿: 215 参加年月日: 15/04/04 最新の投稿
David H Nebinger:
You can likely emulate this using audience targeting and/or drools.

In general, though, you have to remember that this kind of logic adds time to page loads. When complicated logic is added into page rendering, render times increase and that cost may not be worth the extra complexity.



Thanks David, could you expand more on your proposed solutions
thumbnail
7年前 に David H Nebinger によって更新されました。

RE: Liferay Portlet Admin Config Dialogue

Liferay Legend 投稿: 14919 参加年月日: 06/09/02 最新の投稿
With audience targeting, you can build rather complex rules for displaying content. This won't affect portlet display, it's only for content.

Drools is a rules engine that you can use to define rules, but this will have more options than just content.

You can define an AND role yourself, however. So if I have to be both a FARMER and a HERDER, I could define a FARMER_HERDER role and only given that to folks that have both. On the perms page you can grant view to FARMER_HERDER and that would only affect folks with that role. Heck, you could even do a post login hook to give the FARMER_HERDER role automatically to users that have both.

I guess this could actually lead to a code-based solution. If I need a ((FARMER AND HERDER) AND (NOT COW_HERDER)), you define the role FARMER_HERDER_NOT_COWS and create a post login hook. The hook checks if a user satisfies these role requirements and, if so, grants the user the role otherwise it takes the role away (handles future user/role changes).

It's a little bit of coding, but certainly a lighter-weight solution than most others...
thumbnail
7年前 に darren rose によって更新されました。

RE: Liferay Portlet Admin Config Dialogue

Regular Member 投稿: 215 参加年月日: 15/04/04 最新の投稿
David H Nebinger:
With audience targeting, you can build rather complex rules for displaying content. This won't affect portlet display, it's only for content.

Drools is a rules engine that you can use to define rules, but this will have more options than just content.

You can define an AND role yourself, however. So if I have to be both a FARMER and a HERDER, I could define a FARMER_HERDER role and only given that to folks that have both. On the perms page you can grant view to FARMER_HERDER and that would only affect folks with that role. Heck, you could even do a post login hook to give the FARMER_HERDER role automatically to users that have both.

I guess this could actually lead to a code-based solution. If I need a ((FARMER AND HERDER) AND (NOT COW_HERDER)), you define the role FARMER_HERDER_NOT_COWS and create a post login hook. The hook checks if a user satisfies these role requirements and, if so, grants the user the role otherwise it takes the role away (handles future user/role changes).

It's a little bit of coding, but certainly a lighter-weight solution than most others...


I am doing this for my custom roles, but I did hope the UI would support this logic without having to code this and create new roleA_and_roleB roles. But, yes, I can code that.
thumbnail
7年前 に darren rose によって更新されました。

RE: Liferay Portlet Admin Config Dialogue

Regular Member 投稿: 215 参加年月日: 15/04/04 最新の投稿
How would I use Drools with Liferay to support controlling portlet visibility where I want a portlet shown if user has role A and role B, or role A and not role C?

regards