コード例 #1
0
 /// <summary>
 /// 分配用户角色
 /// </summary>
 public async Task AssignRoles(AssignRolesInput input, int tenantId)
 {
     using (CurrentUnitOfWork.SetTenantId(tenantId))
     {
         await _userAppService.AssignRoles(input);
     }
 }
コード例 #2
0
        /// <summary>
        /// 分配用户角色
        /// </summary>
        public async Task AssignRoles(AssignRolesInput input)
        {
            var user = await UserManager.GetUserByIdAsync(input.UserId);

            if (user == null)
            {
                throw new UserFriendlyException($"用户ID:[{input.UserId}]不存在!");
            }

            CheckErrors(await UserManager.SetRoles(user, input.AssignedRoleNames));
        }