How to hide People Who can View option in Page Tools for Anonymous Users and Specific Groups in Confluence?

お困りですか?

アトラシアン コミュニティをご利用ください。

コミュニティに質問

プラットフォームについて: Server および Data Center のみ。この記事は、Server および Data Center プラットフォームのアトラシアン製品にのみ適用されます。

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.

*Fisheye および Crucible は除く

目的

The People who can view allows users to see the list of users who can view the Page. If you need to hide this menu option from Page tools for  anonymous users or specific groups, you may do so by using JavaScript.

ソリューション

How to hide People who can view for Anonymous users

  1. Navigate to Confluence Admin >> Custom HTML
  2. Click Edit
  3. Add the following to At the end of the HEAD section and click  Save:. Once this is done, People who can view will be hidden for anonymous users.

    <script type="text/javascript">
        AJS.toInit(function(){
            if (AJS.params.remoteUser == ''){
              AJS.$('#who-can-view-button-ak-button').hide();
             
            }
        });
    </script>

How to hide People who can view option for users that are not members of confluence-admin group

  1. Navigate to Confluence Administration page >> Layout.
  2. Under the Site Layouts, search for Main Layout and click Edit/Create Custom.
  3. Find the following section: <head> and </head> tags.
  4. Copy and paste the following code before the </head> tag.

    #if ($userAccessor.hasMembership('confluence-administrators', $helper.action.remoteUser.name))
    #else
        <script type="text/javascript">
        AJS.toInit(function(){
    AJS.$('#who-can-view-button-ak-button').hide();
        });
    </script>
    #end


How to hide People who can view option for users that are members of specific groups

  1. Navigate to Confluence Administration page >> Layout.
  2. Under the Site Layouts, search for Main Layout and click Edit/Create Custom.
  3. Find the following section: <head> and </head> tags.
  4. Copy and paste the following code before the </head> tag.

    #if ($userAccessor.hasMembership('confluence-administrators', $helper.action.remoteUser.name) || $userAccessor.hasMembership('confluence-users', $helper.action.remoteUser.name) )
        <script type="text/javascript">
        AJS.toInit(function(){
        AJS.$('#who-can-view-button-ak-button').show();
        });
        </script>
    #else
        <script type="text/javascript">
        AJS.toInit(function(){
        AJS.$('#who-can-view-button-ak-button').hide();
        });
        </script>
    #end
  5. Replace the groups confluence-administrators and confluence-users with your required groups. Once saved, users of only these groups will be able to see the People who can view option.

関連コンテンツ

Collapse

  1. How to hide elements in Confluence using CSS or JavaScript
最終更新日 2020 年 7 月 22 日

この内容はお役に立ちましたか?

はい
いいえ
この記事についてのフィードバックを送信する
Powered by Confluence and Scroll Viewport.