Any way in Javascript to tell if the current user is a 'confluence-administrator' ?

Dean Williams February 20, 2013

In Javascript, is there any way to determine if the current user ( AJS.params.remoteUser ) is a member of the group 'confluence-administrators' ?

Thanks !

2 answers

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

1 vote
Answer accepted
GuilhermeA
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 25, 2013

Hello Dean,

On Javascript exactly I don't know, but I know on Velocity Script, should at least give you a good guidance :) I hope.

To pickup a list of groups from the Current User looking the page use this:

#set ($groups = $userAccessor.getGroupNames($action.remoteUser))

and to see if it is from confluence-administrators:


#if ($groups.contains("confluence-administrators"))

Hope this helps you!

Cheers,

Guilherme

Dean Williams March 13, 2013

Thanks Guilherme ... much appreciated !

2 votes
Joe Clark
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
February 26, 2013

No, this information is not present in the client unless specifically requested. Additionally, retrieving group membership information requires administrative permissions, so you can't simply make an AJAX call in the current user's HTTP session.

You'd need to do this on the server, by writing a plugin and then exposing this information over REST, XML-RPC or something similar - however, keep in mind that vanilla Confluence treats group memberships as sensitive information.

Dean Williams March 13, 2013

Thanks Joe ! Your comment makes perfect sense. Luckily the above workaround meets my needs.

Ryan McBryde January 23, 2019

Hi Joe,

I was hoping that you might be able to help me.  My user community wants to disable the presentation of the Space and People tabs and I have found that I can do that for anonymous users or for a specific user as described here:

https://community.atlassian.com/t5/Confluence-questions/How-to-hide-People-tab-in-Confluence/qaq-p/401785

I have tested it successfully with a specific user id or by using empty quotes:

 if (AJS.params.remoteUser == 'testuser' )

What I am trying to do however is to disable for ALL logged in users but trying "*" as  a wildcard didn't work.  Is there a way to do this that you know of?

Thank you

TAGS
AUG Leaders

Atlassian Community Events