Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Note: This is only for the MTOA Platform Team.

Description

Retrieves a user's role per service based on an application identification number.

Package Details

Interface

Code Block
IUserApplicationManagementManager

Syntax

Code Block
await UserApplicationManagementManager.GetUserRolesByApplication(int applicationId, int userId, bool isActive = true);

Returns

Code Block
ApplicationUserRole

API

GET - /api/v1/userapplications/{id}/roles?userId={userId}&isActive={true|false}

Parameters

Parameter

Description

Type

id

Required

The identification number of the application.

Must be a valid application number.

Path

userId

Required

The user’s identification number the role(s) per service(s).

Must be a valid user id.

Query string

isActive

Optional

If the value is set to true:

Only return services where the user’s enrollment status is set to ‘ACTIVE’ and DATE_STOP_DTE is null.

If the value is set to false:

Returns all services regardless of the of the enrollment status where DATE_STOP_DTE is null.

Default value is ‘true’.

Query string

Returns

HTTP 200 - OK

A list of the user’s roles per service is returned.

Example JSON.

Code Block
languagejson
[
  {
    "RoleId": 1,
    "ServiceId": 1,
    "StartDate": "2022-01-01T12:00:00",
    "EndDate": null,
    "EnrollmentStatusCd": "ACTIVE"
  },
  {
    "RoleId": 1,
    "ServiceId": 2,
    "StartDate": "2022-01-01T12:00:00",
    "EndDate": null,
    "EnrollmentStatusCd": "ACTIVE"
  }
]

HTTP 400 - Bad Request

Error

Message

MTAPI Status Code

Invalid user id

UserId:{userId} couldn't be found.

4041003

Invalid application id

Application id:{id} couldn't be found.

623001

Get user roles by application failed.

Get user roles for application id: {id} with user id: {userId} failed.

623011

Example

Code Block
languagec#
const int applicationId =1;
const int userId = 1;

var userRoles = await _userApplicationManager.GetUserRolesByApplication(applicationId, userId, true);