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

Platform Notice: Data Center - This article applies to Atlassian products on the Data Center platform.

Note that this knowledge base article was created for the Data Center version of the product. Data Center knowledge base articles for non-Data Center-specific features may also work for Server versions of the product, however they have not been tested. Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.

*Except Fisheye and Crucible

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 Jan 7, 2025

Was this helpful?

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