ModelFactoryGenerateNewRoleAssignment Method

Generates a new role assignment for user recipient

Definition

Namespace: MobileTrack.Common.Extensions
Assembly: MobileTrack.Common (in MobileTrack.Common.dll) Version: 0.7+ce90b2cf6b782b8d7b7fd47b3c546987c652c00f
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