Gets enrollments for a specified user
Description
Given a user ID, and optionally a service ID and organization ID, returns a list of enrollments that the specified user has. The enrollment list indicates the enrollment type (organization, delegated representation, self representation), and the permissions (enum/int) for each organization that the user is associated with.
Package Details
Interface
IAccountManager
Syntax
_accountManager.GetEnrollments(int userId [_, bool activeUser = true_]); _accountManager.GetEnrollments(int userId, int serviceId [_, bool activeUser = true_]); _accountManager.GetEnrollments(int userId, int serviceId, int organizationId [_, bool activeUser = true_]);
Returns
ICollection<EnrollmentInfo>
API
[GET] /api/v1/account/enrollments
userId: [Integer] User id
serviceId: [Integer] Service id
organizationId: [Integer] Organization id
activeUser: [Boolean] If true get all active users, if false get all active and inactive users
Returns
EnrollmentInfo object that contains information about the user enrollments.
Example
var enrollments = await _accountManager.GetEnrollments(userId, serviceId); if (enrollments.Count == 0) { return false; } var enrollment = enrollments.Select(x => x).FirstOrDefault(); if (enrollment == null) { return false; }