1
0
mirror of https://github.com/bitwarden/server.git synced 2025-05-27 06:14:51 -05:00

use policy service

This commit is contained in:
Kyle Spearrin 2020-01-15 09:19:49 -05:00
parent 937bb4359f
commit df4abea345

View File

@ -16,13 +16,16 @@ namespace Bit.Api.Controllers
public class PoliciesController : Controller public class PoliciesController : Controller
{ {
private readonly IPolicyRepository _policyRepository; private readonly IPolicyRepository _policyRepository;
private readonly IPolicyService _policyService;
private readonly CurrentContext _currentContext; private readonly CurrentContext _currentContext;
public PoliciesController( public PoliciesController(
IPolicyRepository policyRepository, IPolicyRepository policyRepository,
IPolicyService policyService,
CurrentContext currentContext) CurrentContext currentContext)
{ {
_policyRepository = policyRepository; _policyRepository = policyRepository;
_policyService = policyService;
_currentContext = currentContext; _currentContext = currentContext;
} }
@ -62,7 +65,7 @@ namespace Bit.Api.Controllers
} }
var policy = model.ToPolicy(orgIdGuid); var policy = model.ToPolicy(orgIdGuid);
//await _groupService.SaveAsync(group, model.Collections?.Select(c => c.ToSelectionReadOnly())); await _policyService.SaveAsync(policy);
return new PolicyResponseModel(policy); return new PolicyResponseModel(policy);
} }
@ -76,7 +79,7 @@ namespace Bit.Api.Controllers
throw new NotFoundException(); throw new NotFoundException();
} }
//await _groupService.SaveAsync(model.ToPolicy(policy)); await _policyService.SaveAsync(model.ToPolicy(policy));
return new PolicyResponseModel(policy); return new PolicyResponseModel(policy);
} }
@ -90,7 +93,7 @@ namespace Bit.Api.Controllers
throw new NotFoundException(); throw new NotFoundException();
} }
//await _groupService.DeleteAsync(policy); await _policyService.DeleteAsync(policy);
} }
} }
} }