Get admin roles through API
Hi all, I'm hoping someone might be able to help me out, as I'm running in to some brick walls on a project...
I believe I have this working for course roles, but I'm running into a problem trying to list out admin roles. I am currently using the admins api to call 'https://<instance>.instructure.com/api/v1/accounts/134/admins?user_id=ENV.current_user_id' if ENV.current_user_roles indicates the user has admin access somewhere. This all works great using my account, which is a full root admin. What I've discovered in testing is that that API call only seems to work if the user's admin role includes the "Admins add / remove" permission. I want my function to work somewhat universally, and for many reasons, I can't give every one of our account roles the ability to add other admins.
If anyone is interested, I put my rough code on my GitHub at https://github.com/cmcasey79/canvas-customizations-by-chris/blob/master/get_user_context_roles.js.
Thanks in advance for any help someone might be able to provide!