Skip to main content
Participant
July 24, 2018
Answered

Switch User Type

  • July 24, 2018
  • 1 reply
  • 602 views

Is there an easy way to switch between learner and admin scope via the API?

Unfortunately, loResourceGrades/{id} is only offered as a learner-level operation and cannot be accessed by an admin user. Get /users/{id}/enrollments is only available to admins. Therefore, I have to log in as an admin to get a list of enrollments for a learner, then log in as a learner to get completion status for each module. Finally, I would need to log back in as an admin to mark a module as complete. It would be great to be able to do everything as one user without having to switch scopes back-and-forth.

Any ideas would be great. Thank you for any help!

This topic has been closed for replies.
Correct answer PRO_SOL

There is no need to switch between Learner and Admin Scope.
If client needs to check loResourceGrade information in admin scope, what he just needs to do is to invoke the below api:
GET /users/{id}/enrollments?include=loResourceGrades
The above api response includes loResourceGrades corresponding to courses enrolled.
enrollment model has one of its relationship as loResourceGrades that's why loResourceGrades is included in the above enrollment endpoint. In General whichever comes in relationship can be included as above.

1 reply

PRO_SOLCorrect answer
Participating Frequently
August 3, 2018

There is no need to switch between Learner and Admin Scope.
If client needs to check loResourceGrade information in admin scope, what he just needs to do is to invoke the below api:
GET /users/{id}/enrollments?include=loResourceGrades
The above api response includes loResourceGrades corresponding to courses enrolled.
enrollment model has one of its relationship as loResourceGrades that's why loResourceGrades is included in the above enrollment endpoint. In General whichever comes in relationship can be included as above.