/** * Gets all ACEs associated with given ACL and the given security identity * * @param SID $sid * @param OID $oid * @param string $type The ACE type. Can be one of self::*_ACE constants * @param string|null $field The name of a field. * Set to null for class-based or object-based ACE * Set to not null class-field-based or object-field-based ACE * @return EntryInterface[] */ protected function doGetAces(SID $sid, OID $oid, $type, $field) { $acl = $this->getAcl($oid); if (!$acl) { return array(); } return array_filter($this->aceProvider->getAces($acl, $type, $field), function ($ace) use(&$sid) { /** @var EntryInterface $ace */ return $sid->equals($ace->getSecurityIdentity()); }); }
/** * @dataProvider aceTypesProvider */ public function testDeleteAce($type, $field) { $index = 1; $mask = 123; $strategy = 'any'; if ($field === null) { $this->acl->expects($this->once())->method('delete' . $type . 'Ace')->with($this->equalTo($index)); } else { $this->acl->expects($this->once())->method('delete' . $type . 'FieldAce')->with($this->equalTo($index), $this->equalTo($field)); } $this->manipulator->deleteAce($this->acl, $type, $field, $index, $mask, $strategy); }