ModelFactoryGenerateNewRoleAssignment Method

Generates a new role assignment for user recipient

Definition

Namespace: MobileTrack.Common.Extensions
Assembly: MobileTrack.Common (in MobileTrack.Common.dll) Version: 0.8+34f1bbd8dc6b32752cfce829cbed66e15113d7ba
public static RoleAssignmentDto GenerateNewRoleAssignment(
	AccountDto recipient,
	RoleDto? role = null,
	EnvironmentDto? scope = null
)

Parameters

recipient  AccountDto
User that receives the role assignment.
role  RoleDto  (Optional)
Role to assign. If left , the recipient's default role will be used.
scope  EnvironmentDto  (Optional)
Scope to assign. If left , the recipient's assigned environment will be used.

Return Value

RoleAssignmentDto
Generated role assignment

Exceptions

InvalidOperationException If scope isn't but the environment isn't part of the same company as recipient.
InvalidOperationException If role isn't company-agnostic and doesn't belong to the same company as recipient.
InvalidOperationException Thrown if the determined EnvironmentId or RoleId are Empty after parsing. This should never happen!

See Also