Exemplo n.º 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));
        }
Exemplo n.º 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));
        }
Exemplo n.º 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));
        }
Exemplo n.º 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));
        }
Exemplo n.º 5
0
 public async Task PutUsers(string orgId, string id, [FromBody] SubvaultRequestModel model)
 {
 }