Get user on Touch UI

antond26624417 28-09-2018

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!

Accepted Solutions (1)

Accepted Solutions (1)

aneeta45259594 28-09-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.


Aneet Arora

Answers (6)

Answers (6)

smacdonald2008 28-09-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 28-09-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.