public async Task <ResponseBase <bool> > AddScope(AddScopeInput input) { var item = _clientRepository.Query().FirstOrDefault(a => a.Id == input.ClientId); if (item == null) { return(new ResponseBase <bool>() { Message = "客户端不存在", Result = false }); } if (item.AllowedScopes.Any(a => a.Scope.Equals(input.Scope, StringComparison.OrdinalIgnoreCase))) { return(new ResponseBase <bool>() { Message = "客户端请求域已存在", Result = false }); } (item.AllowedScopes ?? new List <ClientScope>()).Add(new ClientScope() { Scope = input.Scope }); await _clientRepository.Update(item); await _publishEndpoint.Publish(new ValueEntered() { Value = item.ClientId }); return(new ResponseBase <bool>() { Result = true }); }
public async Task <ResponseBase <bool> > AddScope(AddScopeInput input) { return(await _clientService.AddScope(input)); }