Expand my Community achievements bar.

SOLVED

Get user on Touch UI

Avatar

Level 2

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!

1 Accepted Solution

Avatar

Correct answer by
Level 5

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

View solution in original post

7 Replies

Avatar

Level 10

This use case will be implemented via JS.

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

Avatar

Level 10

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...

    function getLoggedInUserID(){

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

    }

Avatar

Correct answer by
Level 5

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

Avatar

Level 2

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.

Avatar

Level 10

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.

Avatar

Level 2

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