public async Task <CipherMiniResponseModel> PostAdmin([FromBody] CipherCreateRequestModel model) { var cipher = model.Cipher.ToOrganizationCipher(); if (!_currentContext.OrganizationAdmin(cipher.OrganizationId.Value)) { throw new NotFoundException(); } var userId = _userService.GetProperUserId(User).Value; await _cipherService.SaveAsync(cipher, userId, model.CollectionIds, true, false); var response = new CipherMiniResponseModel(cipher, _globalSettings, false); return(response); }
public async Task <CipherResponseModel> PostCreate([FromBody] CipherCreateRequestModel model) { var userId = _userService.GetProperUserId(User).Value; var cipher = model.Cipher.ToCipherDetails(userId); if (cipher.OrganizationId.HasValue && !_currentContext.OrganizationUser(cipher.OrganizationId.Value)) { throw new NotFoundException(); } await _cipherService.SaveDetailsAsync(cipher, userId, model.CollectionIds, cipher.OrganizationId.HasValue); var response = new CipherResponseModel(cipher, _globalSettings); return(response); }