/** * {@inheritDoc} */ public function isFieldGranted(AclInterface $acl, $field, array $masks, array $sids, $administrativeMode = false) { $result = null; // check object ACEs $aces = $acl->getObjectFieldAces($field); if (!empty($aces)) { $result = $this->hasSufficientPermissions($acl, $aces, $masks, $sids, $administrativeMode); } // check class ACEs if object ACEs were not found if ($result === null) { $aces = $acl->getClassFieldAces($field); if (!empty($aces)) { $result = $this->hasSufficientPermissions($acl, $aces, $masks, $sids, $administrativeMode); } } // check parent ACEs if object and class ACEs were not found if ($result === null && $acl->isEntriesInheriting()) { $parentAcl = $acl->getParentAcl(); if ($parentAcl !== null) { $result = $parentAcl->isFieldGranted($field, $masks, $sids, $administrativeMode); } } // throw NoAceFoundException if no any ACEs were found if ($result === null) { throw new NoAceFoundException(); } return $result; }
/** * {@inheritdoc} */ public function isFieldGranted(AclInterface $acl, $field, array $masks, array $sids, $administrativeMode = false) { try { try { $aces = $acl->getObjectFieldAces($field); if (!$aces) { throw new NoAceFoundException(); } return $this->hasSufficientPermissions($acl, $aces, $masks, $sids, $administrativeMode); } catch (NoAceFoundException $noObjectAces) { $aces = $acl->getClassFieldAces($field); if (!$aces) { throw $noObjectAces; } return $this->hasSufficientPermissions($acl, $aces, $masks, $sids, $administrativeMode); } } catch (NoAceFoundException $noClassAces) { if ($acl->isEntriesInheriting() && null !== ($parentAcl = $acl->getParentAcl())) { return $parentAcl->isFieldGranted($field, $masks, $sids, $administrativeMode); } throw $noClassAces; } }