The idea, simply put, is to provide a more detailed list of the roles assigned and applicable to a user given the context of where they are in Canvas. I'd guess that the simplest option would to list role IDs, instead of "admin." Alternatively, assuming role names have to be unique, the role name could be parsed into the role list (i.e., "Dean" would parse to "dean;" "Program Director" could parse to "programDirector;" etc.).
Now, to explain what I'm suggesting and provide context for those that don't already know what I'm talking about:
Our first thought is: what information is most accessible to us on any given page? The answer is the ENV variable. Under it is basic user information, including current_user_roles.
Here's the problem, they're generic! All users assigned a role at the account-level are designated as having an "admin" role. Those users assigned a role at for account 1 are designated has having a "root_admin" role. It doesn't care that user 632 is a "Dean" and user 8326 is a "Student Success Coordinator," it just looks at where they're assigned permissions.
ENV.current_user_roles = ["user", "student", "teacher", "admin"];
Second thought was: use API calls to pull the actual roles. Well, due to the permission restrictions, this isn't viable. Just because a role is assigned to the user doesn't mean the user would be able to retrieve role information. So, it needs elevated permissions to make the API call, which then puts credentials into client-side executable code. Yeah, not gonna happen.
Third thought: third-party server-size validation accessed via XHR. Overkill for such a small feature.