Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.
SOLVED

Get user details in touch ui dialog listener

Avatar

Level 2

Hi,

I want to get the user details in aem touch ui dialog listener. I need to know the user when a particular filed is modified/updated in dialog.

Thanks,

AG

1 Accepted Solution

Avatar

Correct answer by
Level 2

Finally found it.

Granite.author.ContentFrame.getUserID()

to get user id in EDIT mode TOUCH UI js.

View solution in original post

5 Replies

Avatar

Employee Advisor

If  you are looking for change visibility of dialog property  based on user permissions / user cred, you can use renderconditions.

Create rendercondition like /libs/granite/ui/components/coral/foundation/renderconditions/privilege and use it on the dialog field like /libs/dam/gui/content/assets/annotate/jcr:content/actions/moveasset/granite:rendercondition.

If you want to get the user details in the dialog field, you should use jackrabit Usermanager API

reference - https://stackoverflow.com/questions/34631873/how-to-get-user-list-of-given-group-in-aem6-1

Dialog widget reference - How can we select the user from Dialog widget

Avatar

Level 2

Hi nirmaljosehere

Thanks for writing. I need to the the user who is updating the component in dialog listener (Touch UI). I want to store the user id/name of author who is updating the specific textarea(only) of a component. Assume a component has 5 fields in dialog, AEM stores the lastModifiedBy if any of those fields updated. I want to store the user name only when one(specific filed, say text area) of those five fields got updated.

Thanks.

Avatar

Employee Advisor

I don't know any quick route for this one, but you can implement the below.

1. Create a servlet like /bin/getCurrentUser using logic in [1] (not to create user, but to get current user )

2. The servlet should send back the current user

3. Create a listener for the dialog fields you need and write a listener logic to invoke the servlet and update the response to the specific field.

[1] - Adobe Experience Manager Help | Using Jackrabbit UserManager APIs to create AEM Users and Groups

Avatar

Correct answer by
Level 2

Finally found it.

Granite.author.ContentFrame.getUserID()

to get user id in EDIT mode TOUCH UI js.

Avatar

Community Advisor

There is an JSON API which return current user details, In case needed somewhere else.

http://localhost:4504/libs/granite/security/currentuser.json



Arun Patidar