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); 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
Task<ICollection<EnrollmentInfo>>
API
[GET] /api/v1/account/enrollments
Parameters
Parameter | Description | Parameter Type |
---|---|---|
userId: [Integer] | User id | query string |
serviceId: [Integer] | Service id | query string |
organizationId: [Integer] | Organization id | query string |
activeUser: [Boolean] | If true get all active users, if false get all active and inactive users | query string |
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; }