Note: This is only for the MTOA Platform Team.
Description
Enroll a user in an application with a role associated with services and permissions.
Package Details
Interface
IUserApplicationManagementManager
Syntax
await UserApplicationManagementManager.EnrollUser(int appId, int userId, UserRoleType roleId, int createdByUserId, int? organizationId = null);
Returns
void
API
POST - /api/v1/userapplications/{id}/enrolluser
Parameters
Parameter | Description | Type |
---|---|---|
id | The identification number of the application. | Path |
userId | The identification number of the user. | Query string |
userAppServices | Services of the user application enrollment Service id: Rold id (UserRoleType): Role id of the service that the user is going to be enrolled | Request body |
createdByUserId | User id who is enrolling this user | Query string |
Returns
HTTP 200 - OK
Example
const int applicationId = 12; const int userId= 1234; const int createdByUserId= 5678; List<AddUserApplicationService> userAppServices = new List<AddUserApplicationService>(); userAppServices.Add(new AddUserApplicationService { RoleId = UserRoleType.Clerk, ServiceCd = 230 }); userAppServices.Add(new AddUserApplicationService { RoleId = UserRoleType.Inspector, ServiceCd = 231 }); userAppServices.Add(new AddUserApplicationService { RoleId = UserRoleType.Manager, ServiceCd = 232 }); List<UserApplicationService> userAppServicesList = new List<UserApplicationService>(); foreach (var userAppService in userAppServices) { userAppServicesList.Add(userAppService); } //Enroll the user await MtoaApi.UserApplicationManagementApi.EnrollUser(mitracAppId, user.Id, userAppServices, createdByUserId); await _userApplicationManagementManager.EnrollUser(applicationId, userId, userRoleType, createdByUserId);