How to Restrict Users from Accessing People Directory or Search Users from Quick Search

Still need help?

The Atlassian Community is here for you.

Ask the community

Atlassian Support Offerings

The following approaches are considered Confluence customization that is beyond Atlassian Support Offerings. Atlassian will not be held liable for any errors or other unexpected events resulting from the use of the customization.

Hiding People Directory

You may apply the following steps to prevent users from accessing user information due to confidentiality. 

  1. Access Confluence Admin or click the Cog icon,  and choose General Configuration.
  2. Go to Look and Feel panel and click Layouts.
  3. Under the Site Layouts, search for Main Layout and click Edit/Create Custom.
  4. Find the following section: <head> and </head>.
  5. Copy and paste the following code before </head>.

    #if ($userAccessor.hasMembership('<insert-group-with-access>', $helper.action.remoteUser.name))
    #else
        <script type="text/javascript">
        AJS.toInit(function(){ 
    AJS.$('#people-directory-link').hide();
        });
    </script>
    #end
  6. Save the changes.

(info) Please replace the code: "<insert-group-with-access>" with the group that allowed to access the People Directory (i.e. confluence-administrators).

Hiding Quick Search

User is still able to access the user information by searching the user in the Quick Search bar. Therefore, Quick Search bar is required to hide as well

  1. Access Confluence Admin or click the Cog icon,  and choose General Configuration.
  2. Go to Look and Feel panel and click Layouts.
  3. Under the Site Layouts, search for Main Layout and click Edit/Create Custom.
  4. Find the following section: <head> and </head>.
  5. Copy and paste the following code before </head>.

    #if ($userAccessor.hasMembership('<insert-group-with-access>', $helper.action.remoteUser.name))
    #else
        <script type="text/javascript">
        AJS.toInit(function(){ 
    AJS.$('#quick-search-query').hide();
        });
    </script>
    #end

    (warning) Insert the following code: AJS.$('#quick-search-query').hide(); into the body if you have already apply the previous code.

  6. Save the changes.

(info) Please replace the code: "<insert-group-with-access>" with the group that allowed to access the People Directory (i.e. confluence-administrators).


(info) There is an improvement request raised at  CONF-7837 - Getting issue details... STATUS .

Last modified on Oct 7, 2022

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.