Get user details in touch ui dialog listener | Community
Skip to main content
Level 2
July 6, 2019
Solved

Get user details in touch ui dialog listener

  • July 6, 2019
  • 5 replies
  • 3880 views

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

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by AG19

Finally found it.

Granite.author.ContentFrame.getUserID()

to get user id in EDIT mode TOUCH UI js.

5 replies

Nirmal_Jose
Adobe Employee
Adobe Employee
July 7, 2019

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

AG19Author
Level 2
July 8, 2019

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.

Nirmal_Jose
Adobe Employee
Adobe Employee
July 8, 2019

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

AG19AuthorAccepted solution
Level 2
July 12, 2019

Finally found it.

Granite.author.ContentFrame.getUserID()

to get user id in EDIT mode TOUCH UI js.

arunpatidar
Community Advisor
Community Advisor
July 12, 2019

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