Пример #1
0
        public async Task <SubvaultResponseModel> Post(string orgId, [FromBody] SubvaultRequestModel model)
        {
            // TODO: permission check
            var subvault = model.ToSubvault(new Guid(orgId));
            await _subvaultRepository.CreateAsync(subvault);

            return(new SubvaultResponseModel(subvault));
        }
Пример #2
0
        public async Task <SubvaultResponseModel> Put(string orgId, string id, [FromBody] SubvaultRequestModel model)
        {
            var subvault = await _subvaultRepository.GetByIdAsync(new Guid(id));

            if (subvault == null || !_currentContext.OrganizationAdmin(subvault.OrganizationId))
            {
                throw new NotFoundException();
            }

            await _subvaultService.SaveAsync(model.ToSubvault(subvault));

            return(new SubvaultResponseModel(subvault));
        }
Пример #3
0
        public async Task <SubvaultResponseModel> Put(string orgId, string id, [FromBody] SubvaultRequestModel model)
        {
            var subvault = await _subvaultRepository.GetByIdAdminUserIdAsync(new Guid(id),
                                                                             _userService.GetProperUserId(User).Value);

            if (subvault == null)
            {
                throw new NotFoundException();
            }

            await _subvaultRepository.ReplaceAsync(model.ToSubvault(subvault));

            return(new SubvaultResponseModel(subvault));
        }
Пример #4
0
        public async Task <SubvaultResponseModel> Post(string orgId, [FromBody] SubvaultRequestModel model)
        {
            var orgIdGuid = new Guid(orgId);

            if (!_currentContext.OrganizationAdmin(orgIdGuid))
            {
                throw new NotFoundException();
            }

            var subvault = model.ToSubvault(orgIdGuid);
            await _subvaultService.SaveAsync(subvault);

            return(new SubvaultResponseModel(subvault));
        }
Пример #5
0
 public async Task PutUsers(string orgId, string id, [FromBody] SubvaultRequestModel model)
 {
 }