public async Task DelegateNewUser(CreateUserDelegationDto input) { if (input.TargetUserId == AbpSession.GetUserId()) { throw new UserFriendlyException(L("SelfUserDelegationErrorMessage")); } CheckUserDelegationOperation(); var delegation = ObjectMapper.Map <UserDelegation>(input); delegation.TenantId = AbpSession.TenantId; delegation.SourceUserId = AbpSession.GetUserId(); await _userDelegationRepository.InsertAsync(delegation); }
public async Task DelegateNewUser(CreateUserDelegationDto input) { if (input.TargetUserId == AbpSession.GetUserId()) { throw new Exception("You can't delegate authorization to yourself !"); } CheckUserDelegationOperation(); var delegation = ObjectMapper.Map <UserDelegation>(input); delegation.TenantId = AbpSession.TenantId; delegation.SourceUserId = AbpSession.GetUserId(); await _userDelegationRepository.InsertAsync(delegation); }