public function updatePolicyByRoleDraft($roleId, $policyId, Request $request)
{
$updateStruct = $this->inputDispatcher->parse(new Message(array('Content-Type' => $request->headers->get('Content-Type')), $request->getContent()));
$role = $this->roleService->loadRoleDraft($roleId);
foreach ($role->getPolicies() as $policy) {
if ($policy->id == $policyId) {
try {
return $this->roleService->updatePolicy($policy, $updateStruct);
} catch (LimitationValidationException $e) {
throw new BadRequestException($e->getMessage());
}
}
}
throw new Exceptions\NotFoundException("Policy not found: '{$request->getPathInfo()}'.");
}