Expand my Community achievements bar.

Guidelines for the Responsible Use of Generative AI in the Experience Cloud Community.
SOLVED

Display logo based on which group logged in user is part of

Avatar

Level 3

Hi,

I have a component that displays a logo on a page, I need to be able to dynamically change this logo depending on what group the user is a member of. For example let's say we have two users, James & Paul and they belong to two separate groups. James is in group A and Paul is is group B, I want to only show img for group A and a different img src if they are in group B.

Sudo:

<img class="ui image"

                  src="${

                    (

                      (user group == 'group A') ? ('show logo for group A')

                       :(

                          (user group == 'group B') ? ('show logo for group A')

                          :(

                              'default logo'

                           )

                        )

                     )

}"/>                                

How can I do this? I am having some trouble trying to reference user's group, I can do it with the name but need to be able to do it with it's group. 

-Arman

1 Accepted Solution

Avatar

Correct answer by
Level 10

Jackrabbit API provide method ismemberof which can you tell which group is current user part of.

https://jackrabbit.apache.org/api/2.8/org/apache/jackrabbit/api/security/user/Authorizable.html#memb...

Also worth taking a look at

https://jackrabbit.apache.org/oak/docs/security/user.html

View solution in original post

1 Reply

Avatar

Correct answer by
Level 10

Jackrabbit API provide method ismemberof which can you tell which group is current user part of.

https://jackrabbit.apache.org/api/2.8/org/apache/jackrabbit/api/security/user/Authorizable.html#memb...

Also worth taking a look at

https://jackrabbit.apache.org/oak/docs/security/user.html