Change text in the restriction pop up

Dominic Lagger
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.
April 28, 2021

Hi all

Is there any possibility (JS, ScriptRunner, other ideas) to change the text in the restriction pop up? 

image.png

Use Case: A lot of user doesn't understand, that the edit restriction isn't the edit permission. So they ask, why the user do not have edit permission although they "give them permission".

Thanks for any idea!

Regards, Dominic

2 answers

1 vote
Thiago Masutti
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
April 28, 2021

Hi Dominic.

The following JavaScript might help to get you started with the goal, which you can append to the Custom HTML admin section.

<script type="text/javascript">
$( document ).ajaxSuccess(function( event, request, settings ) {
if (settings.url.indexOf("getcontentpermissions.action") >= 0 && (event.currentTarget.URL.indexOf("viewpage.action") >= 0 || event.currentTarget.URL.indexOf("/display/") >= 0)){
console.log("ajaxSuccess",settings.url, event.currentTarget.URL);
if ($('span.page-restrictions-dialog-explanation').html().indexOf("Everyone can view and edit this page") >= 0){
$('span.page-restrictions-dialog-explanation').html('Your custom text');
}

}
});
</script>

This script does:

  • Listen to XHR successful load events, which in this case is the user opening the Restrictions popup.
    • Subsequent code is only executed if the XHR event came from the view page.
  • If the current text is "Everyone can view and edit this page", then it changes to "Your custom text".

I just couldn't find a way to bind it to changes on the selector.
So if the user changes from No restrictions to something else and then gets back to No restrictions, then the original text would be used.

Kind regards,
Thiago Masutti

Dominic Lagger
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.
April 28, 2021

Hey @Thiago Masutti 

Thanks a lot for your help!

It's pitty, that you couldn't find a way to bind the selector changes. Because I want to show a message only in the "Only some people can view or edit"-Case.

Because then, the user thinks "Oh I gave him edit permissions", and then a support ticket could be avoid when the text would be "Only some people can view or edit. Make sure to give edit permission on the space" (Something like that)

Regards, Dominic

Thiago Masutti
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
April 30, 2021

I see @Dominic Lagger 

If editing a bundled plugin is an option to you, which would also require you to make modifications on every upgrade, then you can change the original plugin and the related file in the translation plugins for target languages.

  •  confluence-page-restrictions-dialog-<version>.jar
    • page-restrictions-dialog.properties
  • confluence-language-pack-<language>-<version>.jar
    • page-restrictions-dialog<language>.properties

The jar files are located in <confluence-install>/confluence/WEB-INF/atlassian-bundled-plugins

These may be the target options:


option.edit.description=Everyone can view, only some can edit.
option.none.description=Everyone can view and edit this page.
option.viewedit.description=Only some people can view or edit.

Changing these files requires a restart and clearing the plugins cache is recommended.
If using data center, this should be changed on all nodes of the cluster.

Kind regards,
Thiago Masutti

0 votes
Thomas Deiler
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
April 28, 2021

Dear @Dominic Lagger ,

removed my answer. The one of @Thiago Masutti is the best! Please accept that one.

So long

Thomas

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events