Get user on Touch UI | Community
Skip to main content
antond26624417
September 28, 2018
Solved

Get user on Touch UI

  • September 28, 2018
  • 7 replies
  • 3246 views

I'm currently try to find the way how I can restrict the using "source mode" for RTE only for administrator.
So I need to get a current user in js. I found out that for Classic UI we can use "CQ.User.getCurrentUser(). What is the way to get this User on Touch UI?
Or it will be better to use Java API for this and then make ajax call from jquery.
Thanks in advance!

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 aneetarora

Hello antond26624417

You can create a rep:policy node on your component to restrict this access.

1) Go to /useradmin

2) Deny permissions for everyone group on the misctools under your RTEplugins node

3) Admin user, and any member of administrator's group will have access to this node and therefore the sourceedit feature as well.

Hope this approach helps.

Regards,

Aneet Arora

7 replies

smacdonald2008
September 28, 2018

This use case will be implemented via JS.

I am talking to our touch ui experts to get more details for you!

antond26624417
September 28, 2018

smacdonald2008​ Thanks!

smacdonald2008
September 28, 2018

Our touch ui expert relied -

Here is a sample http://experience-aem.blogspot.com/2018/07/aem-64-touch-ui-show-checked-out-user-in-content-fragment-editor.html

    function getLoggedInUserID(){

        return window.sessionStorage.getItem("granite.shell.badge.user");

    }

aneetaroraAdobe EmployeeAccepted solution
Adobe Employee
September 28, 2018

Hello antond26624417

You can create a rep:policy node on your component to restrict this access.

1) Go to /useradmin

2) Deny permissions for everyone group on the misctools under your RTEplugins node

3) Admin user, and any member of administrator's group will have access to this node and therefore the sourceedit feature as well.

Hope this approach helps.

Regards,

Aneet Arora

antond26624417
September 28, 2018

smacdonald2008​ Not sure this object exist for me, since It always returns null.
Also I need to check that this user should belong to "administrators" group.

It's not clear how we can use javascript  in comparison with Java API.

smacdonald2008
September 28, 2018

In that article that  Sreekanth suggest you look at - you can see an example of using JavaScript.  In this user case - you want to modify RTE source view based on the user. To do this - you would not use a Java API.

antond26624417
October 2, 2018

aneeta45259594​ It would be the best one for our case!
Thanks both of you! smacdonald2008