@@ -34,15 +34,15 @@ Ext4.define('LABKEY.Security.ImpersonateUser', {
3434 } ,
3535
3636 getPanel : function ( ) {
37- var instructions = LABKEY . Security . currentUser . isRootAdmin ?
38- "As a site administrator, application administrator, or impersonating troubleshooter , you can impersonate any user on the site." +
39- ( ! LABKEY . Security . currentUser . isSystemAdmin ? " While impersonating you will not inherit the user's "
40- + "site-level roles (e.g., Site Administrator, Developer)." : "" ) :
37+ const instructions = LABKEY . Security . currentUser . canImpersonateSiteRoles ?
38+ "As " + getRootAdminRole ( LABKEY . Security . currentUser ) + " , you can impersonate any user on the site." +
39+ ( ! LABKEY . Security . currentUser . canImpersonatePrivilegedRoles ? " While impersonating, you will not inherit the user's "
40+ + "privileged roles (e.g., Site Administrator, Platform Developer)." : "" ) :
4141
42- "As a project administrator , you can impersonate any project user within this project. While impersonating you will be " +
43- "restricted to this project and will not inherit the user's site-level roles (e.g., Site Administrator, Developer)." ;
42+ "As a Project Administrator , you can impersonate any project user within this project. While impersonating, you will be " +
43+ "restricted to this project and will not inherit the user's privileged roles (e.g., Site Administrator, Platform Developer)." ;
4444
45- var divContainer = Ext4 . create ( 'Ext.container.Container' , {
45+ const divContainer = Ext4 . create ( 'Ext.container.Container' , {
4646 html : "<div>" + instructions + "<br><br>Select a user from the list below and click the 'Impersonate' button</div>" ,
4747 margin : '0 0 15 0'
4848 } ) ;
@@ -190,11 +190,14 @@ Ext4.define('LABKEY.Security.ImpersonateGroup', {
190190 } ,
191191
192192 getPanel : function ( ) {
193- var instructions = LABKEY . Security . currentUser . isRootAdmin ?
194- "As a site administrator, application administrator, or impersonating troubleshooter, you can impersonate any site or project group." :
195- "As a project administrator, you can impersonate any project group in this project or any site group in which you're member. While impersonating you will be restricted to this project." ;
196-
197- var divContainer = Ext4 . create ( 'Ext.container.Container' , {
193+ const instructions = LABKEY . Security . currentUser . canImpersonateSiteRoles ?
194+ "As " + getRootAdminRole ( LABKEY . Security . currentUser ) + ", you can impersonate any site or project group. " +
195+ ( ! LABKEY . Security . currentUser . canImpersonatePrivilegedRoles ? " While impersonating, you will not inherit the group's "
196+ + "privileged roles (e.g., Site Administrator, Platform Developer)." : "" ) :
197+ "As a Project Administrator, you can impersonate any project group in this project or any site group of which you're a member. " +
198+ "While impersonating, you will be restricted to this project." ;
199+
200+ const divContainer = Ext4 . create ( 'Ext.container.Container' , {
198201 html : "<div>" + instructions + "<br><br>Select a group from the list below and click the 'Impersonate' button</div>" ,
199202 margin : '0 0 15 0'
200203 } ) ;
@@ -314,12 +317,12 @@ Ext4.define('LABKEY.Security.ImpersonateRoles', {
314317 } ,
315318
316319 getPanel : function ( ) {
317- var instructions = LABKEY . Security . currentUser . canImpersonateSiteRoles ?
318- "As a site administrator, application administrator, or impersonating troubleshooter, you can impersonate one or more security roles. While impersonating you will have access to " +
319- "the entire site, limited to the permissions provided by the selected roles (s)." :
320- "As a project administrator , you can impersonate one or more security roles. While impersonating you will be restricted to this project." ;
320+ const instructions = LABKEY . Security . currentUser . canImpersonateSiteRoles ?
321+ "As " + getRootAdminRole ( LABKEY . Security . currentUser ) + ", you can impersonate one or more security roles. " +
322+ "While impersonating, you will have access to the entire site, limited to the permissions provided by the role (s) you select ." :
323+ "As a Project Administrator , you can impersonate one or more security roles. While impersonating, you will be restricted to this project." ;
321324
322- var divContainer = Ext4 . create ( 'Ext.container.Container' , {
325+ const divContainer = Ext4 . create ( 'Ext.container.Container' , {
323326 html : "<div>" + instructions + "<br><br>Select roles from the list below and click the 'Impersonate' button</div>" ,
324327 margin : '0 0 15 0'
325328 } ) ;
@@ -449,3 +452,15 @@ Ext4.define('LABKEY.Security.ImpersonateRoles', {
449452 } ) ;
450453 }
451454} ) ;
455+
456+ // Return the "highest" role that the current root admin has
457+ function getRootAdminRole ( user )
458+ {
459+ if ( user . isSiteAdmin )
460+ return "a Site Administrator" ;
461+
462+ if ( user . canImpersonatePrivilegedRoles )
463+ return "an Impersonating Troubleshooter" ;
464+
465+ return "an Application Administrator" ;
466+ }
0 commit comments