How to hide the Anonymous Permissions section from Space Permissions
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
This guide is for informational purposes, is at your own risk, and is not eligible for support from Atlassian. If you have any questions about the information on this page, please reach out to our Atlassian Community for help.
Purpose
Administrators may want to take the following steps to prevent Space Administrators from inadvertently enabling Anonymous Access to sensitive content.
For information about Space Permissions, please see our Space Permissions Overview.
Environment
Confluence 8.0.x
Solution
To include CSS inside Custom HTML, go to Confluence Admin > Custom HTML and insert the code in the "At end of the HEAD" textbox.
<script type="text/javascript">
AJS.toInit(function(){
if (AJS.params.remoteUser != 'admin1' && AJS.params.remoteUser != 'admin2' && AJS.params.remoteUser != 'admin3') {
AJS.$('#aPermissionsTable > tbody > tr:nth-child(1) > th:nth-child(3)').hide();
AJS.$('#aPermissionsTable > tbody > tr:nth-child(1) > th:nth-child(4)').hide();
AJS.$('#aPermissionsTable > tbody > tr:nth-child(1) > th:nth-child(5)').hide();
AJS.$('#aPermissionsTable > tbody > tr:nth-child(1) > th:nth-child(6)').hide();
AJS.$('#aPermissionsTable > tbody > tr:nth-child(1) > th:nth-child(7)').hide();
AJS.$('#aPermissionsTable > tbody > tr:nth-child(1) > th:nth-child(8)').hide();
AJS.$('#aPermissionsTable > tbody > tr:nth-child(1) > th:nth-child(9)').hide();
AJS.$('#aPermissionsTable > tbody > tr:nth-child(2) > th:nth-child(3)').hide();
AJS.$('#aPermissionsTable > tbody > tr:nth-child(2) > th:nth-child(4)').hide();
AJS.$('#aPermissionsTable > tbody > tr:nth-child(2) > th:nth-child(5)').hide();
AJS.$('#aPermissionsTable > tbody > tr:nth-child(2) > th:nth-child(6)').hide();
AJS.$('#aPermissionsTable > tbody > tr:nth-child(2) > th:nth-child(7)').hide();
AJS.$('#aPermissionsTable > tbody > tr:nth-child(2) > th:nth-child(8)').hide();
AJS.$('#aPermissionsTable > tbody > tr:nth-child(2) > th:nth-child(9)').hide();
AJS.$('#aPermissionsTable > tbody > tr:nth-child(2) > th:nth-child(10)').hide();
AJS.$('#aPermissionsTable > tbody > tr:nth-child(2) > th:nth-child(11)').hide();
AJS.$('#aPermissionsTable > tbody > tr:nth-child(2) > th:nth-child(12)').hide();
AJS.$('#aPermissionsTable > tbody > tr:nth-child(2) > th:nth-child(13)').hide();
AJS.$('#aPermissionsTable > tbody > tr:nth-child(2) > th:nth-child(14)').hide();
AJS.$('#aPermissionsTable > tbody > tr:nth-child(2) > th:nth-child(15)').hide();
AJS.$('#aPermissionsTable > tbody > tr.space-permission-row > td:nth-child(3)').hide();
AJS.$('#aPermissionsTable > tbody > tr.space-permission-row > td:nth-child(4)').hide();
AJS.$('#aPermissionsTable > tbody > tr.space-permission-row > td:nth-child(5)').hide();
AJS.$('#aPermissionsTable > tbody > tr.space-permission-row > td:nth-child(6)').hide();
AJS.$('#aPermissionsTable > tbody > tr.space-permission-row > td:nth-child(7)').hide();
AJS.$('#aPermissionsTable > tbody > tr.space-permission-row > td:nth-child(8)').hide();
AJS.$('#aPermissionsTable > tbody > tr.space-permission-row > td:nth-child(9)').hide();
AJS.$('#aPermissionsTable > tbody > tr.space-permission-row > td:nth-child(10)').hide();
AJS.$('#aPermissionsTable > tbody > tr.space-permission-row > td:nth-child(11)').hide();
AJS.$('#aPermissionsTable > tbody > tr.space-permission-row > td:nth-child(12)').hide();
AJS.$('#aPermissionsTable > tbody > tr.space-permission-row > td:nth-child(13)').hide();
AJS.$('#aPermissionsTable > tbody > tr.space-permission-row > td:nth-child(14)').hide();
AJS.$('#aPermissionsTable > tbody > tr.space-permission-row > td:nth-child(15)').hide();
AJS.$('#aPermissionsTable > tbody > tr.space-permission-row > td:nth-child(1) > button').hide();
}
}
);
</script>
Tip: If you would like certain space administrators to still be able to view the Anonymous Permission settings, you can include their username in the IF condition in the above CSS.
Result
After applying the custom HTML, we can see the following presentation of the anonymous permission screen. This will be across all spaces, but will not impact other permission types.
Note: This CSS will hide certain elements of the page, like the links, tick boxes, table rows and text. It can be easily reversed.