Detect TA role for global navigation

In order to determine a user's role, it is necessary to add 'TA' as a possible element in the environmental variable ENV.current_user_roles. This would allow custom logic to differentiate among students and teachers when a student is a TA. Currently that student user is arbitrarily assigned the teacher role in the array. This prevents selection of the student TA population separate from teachers for purposes of custom icons and links that may need to be displayed on the global navigation menu. 

I have attached two images which show the values of the array for teacher and student (TA) and they are identical. This forces all TAs to be treated as if they are teachers and that is not the ideal selection for that population. In this specific case I am attempting to use a single instance of a custom icon/link to direct students to one LTI URL and the teachers to another LTI URL for teacher surveys. The values obtained by a TA on the dashboard level force them to the teacher icon/link.

Since all teachers are enrolled in a mandatory course, they all obtain the student value in the three-value array.

7 Comments
James
Community Champion

ejdormady‌,

If you haven't already done so, please check out cesbrandt‌'s question and the discussion that ensues at https://community.canvaslms.com/thread/10448 . There is a nice discussion of the problem and the solution, although it involves custom JavaScript. Of all the people I've seen discussing this issue, Christopher is by far the most knowledgeable one I've encountered.

ejdormady
Community Novice

Thanks James,

Yes, I did review this in my initial attempts and it doesn't apply globally

but rather to a subset of pages. As I am interacting with the global

navigation menu (the side nav on all pages) this is not going to work for

my purposes. At the first landing on the dashboard page, for example the

"TAenrollment" value which would be available as part of the

ENV.permissions object is not in scope. Alas, I can only resolve role with

the ENV.current_user_roles object.

Here's Christopher's comment in the code:

1.

  • Important Note: Additional logic restricts use fo this function

to accounts

2. * and courses pages

James
Community Champion

Here are some possibilities to ponder.

  • Move it into a course navigation menu rather than the global one.
  • Have it on the global navigation menu but hide it unless they're in a location where the roles can be determined.
  • Fetch a list of the courses for the user and if it contains the one that everyone has to sign up for, then consider them a teacher.

There might be some others, but my wife is waiting for me to leave for the weekend, so I'll have to cut it off.

ejdormady
Community Novice

I appreciate the thoughtful response. I have constraints I'm working with

regarding the placement. I do think your third option is the most likely to

provide a valid response, but it's actually the reverse - that I need to

select out the students who are TAs in order to treat them as students. It

seems likely that approach would require a fair amount of programming, data

retrieval and manipulation.

Thanks again and have a great weekend.

Ed

On Fri, Mar 3, 2017 at 2:58 PM, james@richland.edu <instructure@jiveon.com>

James
Community Champion

I wondered if I had gotten that backwards after sending it, but I was getting pressure to leave. After getting home and eating, my brain started functioning. Here's an idea I had a few months ago -- about this very topic, I think -- but had forgotten about it.

One thing you might be able to do is use the Custom Data endpoints of the User API. For those people who are misidentified, you could store a value to a key in the custom data. Then, you try to load the custom data if there's a doubt (both student and teacher are there) about which link should be followed. If the custom data is there, use what it says, otherwise go with the default.

btw - none of this is intended to say that the environment shouldn't define the roles better, I'm just trying to get a workable solution that you can use right now.

cesbrandt
Community Champion
Comments from Instructure

As part of the new Ideas & Themes process, all ideas in Idea Conversations were reviewed by the Product Team. Any Idea that was associated with an identified theme was moved to the new Idea & Themes space. Any Idea that was not part of the move is being marked as Archived. This will preserve the history of the conversations while also letting Community members know that Instructure will not explore the request at this time.

ProductPanda
Instructure
Instructure
Status changed to: Archived
Comments from Instructure

As part of the new Ideas & Themes process, all ideas in Idea Conversations were reviewed by the Product Team. Any Idea that was associated with an identified theme was moved to the new Idea & Themes space. Any Idea that was not part of the move is being marked as Archived. This will preserve the history of the conversations while also letting Community members know that Instructure will not explore the request at this time.