Forums de discussion

Liferay Portlet Admin Config Dialogue

thumbnail
darren rose, modifié il y a 7 années.

Liferay Portlet Admin Config Dialogue

Regular Member Publications: 215 Date d'inscription: 04/04/15 Publications récentes
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
David H Nebinger, modifié il y a 7 années.

RE: Liferay Portlet Admin Config Dialogue

Liferay Legend Publications: 14915 Date d'inscription: 02/09/06 Publications récentes
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
darren rose, modifié il y a 7 années.

RE: Liferay Portlet Admin Config Dialogue

Regular Member Publications: 215 Date d'inscription: 04/04/15 Publications récentes
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
David H Nebinger, modifié il y a 7 années.

RE: Liferay Portlet Admin Config Dialogue

Liferay Legend Publications: 14915 Date d'inscription: 02/09/06 Publications récentes
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
darren rose, modifié il y a 7 années.

RE: Liferay Portlet Admin Config Dialogue

Regular Member Publications: 215 Date d'inscription: 04/04/15 Publications récentes
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
darren rose, modifié il y a 7 années.

RE: Liferay Portlet Admin Config Dialogue

Regular Member Publications: 215 Date d'inscription: 04/04/15 Publications récentes
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