GetByPermission [UserManager]
Get a list of users for a given service by a specific permission, and organization. Requester Id is used to return only users that share an organization with the requester
Description
The GetByPermission() method is used to get a list of users associated to a specific service by a specific permission and organization provided. Results are limited to organizations that the requester is a part of.
Package Details
Interface
IUserManager
Syntax
await UserManager.GetByPermission(int permisssionId, int serviceId, int userId, int? organizationId)
Returns
Task<ICollection<User>>
API
GET
/api/v1/permissions/{permissionId}/services/{serviceid}/users/{userId}?organizationId={organizationId}
Parameters
Parameter | Description | Parameter Type |
---|---|---|
permissionId | Permission Id | Path |
serviceId | Service Id | Path |
userId | Requester Id | Path |
organizationId (Optional) | Specific the organization Id to return users matching service and permission in that organization (OrganizationId must be part of the organizations that the requester is a part of) | Query string |
Returns
On success, 200 Ok
If UserManage.GetByPermission returns null, 422 Unprocessable Entity
On error, 400 Bad Request
On authorization error, 403 Forbidden
Example
int permissionId = 1;
int serviceId = 2;
int userId = 43;
var users = await _userManager.GetByPermission(permissionId, serviceId, userId);
int permissionId = 1;
int serviceId = 2;
int userId = 43;
int orgId = 210;
var users = await _userManager.GetByPermission(permissionId, serviceId, userId, orgId);