Custom JS to Hide +App Button from Course Settings

shane_ohara
Community Champion

Hello, 

We are finding that Canvas permissions for LTI management (when disabled to all roles except for account admins) are not granular enough to allow instructors to edit/delete installed LTIs in a course (example: redirect tool links) while removing the ability to install an entirely new app that has yet to be vetted through our security team. Instructors have the ability to install any account-level app, however.

We would like to hide the +App button from Settings > Apps > View App Configurations. I know how to hide the button using JS, but it seems that the click on View App Configurations invokes an event to happen to re-shows the button. If the page is reloaded, then the button is hidden again using $('.AddExternalToolButton').hide(); from the uploaded JS. 

Account admins should retain access to the button. All non-admin roles should not.

This is what I am using right now:

$(document).ready(function(){
if($.inArray('admin',ENV['current_user_roles']) == -1) {
   $(".AddExternalToolButton").hide();

   console.log ('hide Add App button')

}
});

314791_Screen Shot 2019-06-10 at 8.52.56 AM.png

I am wondering if anyone in this group knows how to hide the button after a click on View App Configurations and the event is triggered?

Best regards,

Shane

Labels (1)