/** * Update a policy. * * Replaces limitations values with new values. * * @param \eZ\Publish\SPI\Persistence\User\Policy $policy */ public function updatePolicy(Policy $policy) { $policy = clone $policy; $this->limitationConverter->toLegacy($policy); $this->roleGateway->removePolicyLimitations($policy->id); $this->roleGateway->addPolicyLimitations($policy->id, $policy->limitations === '*' ? array() : $policy->limitations); }
/** * Removes a policy from a role. * * @param mixed $policyId */ public function removePolicyLimitations($policyId) { try { return $this->innerGateway->removePolicyLimitations($policyId); } catch (DBALException $e) { throw new RuntimeException('Database error', 0, $e); } catch (PDOException $e) { throw new RuntimeException('Database error', 0, $e); } }