Showing results for 
Search instead for 
Did you mean: 
Learner II

current_user_roles options


Is there a way to call out specific admin roles for custom JS? Using current_user_roles, you can only get 'user', 'student', 'teacher' or 'admin', correct?

We would like to add JS that only impacts certain admins, not all admins. For example:

if($.inArray('admin',ENV['current_user_roles']) == -1) { ...

Would not apply to all admins. We want it to not apply to a certain set of admins (account roles).


Anthony Hess

5 Replies
Community Coach
Community Coach

Due to the technical nature of this question I'm going to share it with the Canvas Developers​ and Canvas Admins​ groups in the Community to see if they can help.

Surveyor II

ahess4 I'm really not clear on the context of what you are trying to do, but could you make an API call to get a list of admins and inspect the role in the result?

Admins - List account admins

I don't know if this makes sense in your scenario, just throwing it out there.

Navigator II


You might check out Account Role Detection  by cesbrandt​. He seems to be the expert in the Community on this issue.

@james_jones thanks for referencing that post, good info.

Community Team
Community Team

ahess4​, it's been a while since we last heard from you. Did one or more of the responses posted resolve your issue/concern? For now, I will mark this question as "Assumed Answered"; that will not prevent you or others from responding. If there is a workable solution posted here, please mark that answer as "Correct"--and if you arrived at a different solution, please take a moment to provide additional feedback and update the thread. Thanks!