Example #1
0
 /**
  * @param string        $type
  * @param string|object $classOrObject
  * @param null|string   $field
  *
  * @return ObjectIdentity|FieldVote
  */
 protected function getObjectToSecure($type, $classOrObject, $field = null)
 {
     $objectIdentity = $this->aclIdentifier->getObjectIdentity($type, $classOrObject);
     if (null === $field) {
         return $objectIdentity;
     }
     return new FieldVote($objectIdentity, $field);
 }
 /**
  * @param string $function
  * @param array  $arguments
  *
  * @return mixed
  */
 private function collectManagement($function, $arguments)
 {
     $this->stopwatch->start('acl.managements');
     $result = call_user_func_array([$this->aclManager, $function], $arguments);
     $periods = $this->stopwatch->stop('acl.managements')->getPeriods();
     $oidType = 'Class' === substr($function, -5) ? AclIdentifierInterface::OID_TYPE_CLASS : AclIdentifierInterface::OID_TYPE_OBJECT;
     if ('delete' === substr($function, 0, 6)) {
         $permissions = null;
         $oid = $this->aclIdentifier->getObjectIdentity($oidType, $arguments[0]);
         $sid = null;
         $field = null;
     } else {
         $permissions = $arguments[0];
         $oid = $this->aclIdentifier->getObjectIdentity($oidType, $arguments[1]);
         $sid = false !== strpos($function, 'Role') ? $this->aclIdentifier->getRoleSecurityIdentity($arguments[2]) : $this->aclIdentifier->getUserSecurityIdentity(isset($arguments[2]) ? $arguments[2] : null);
         $field = isset($arguments[3]) ? $arguments[3] : null;
     }
     $this->managements[] = ['method' => $function, 'permissions' => (array) $permissions, 'oid' => $oid, 'sid' => $sid, 'field' => $field, 'time' => end($periods)->getDuration()];
     return $result;
 }
Example #3
0
 /**
  * {@inheritdoc}
  */
 public function deleteAclForObject($object)
 {
     $this->aclProvider->deleteAcl($this->aclIdentifier->getObjectIdentity(AclIdentifierInterface::OID_TYPE_OBJECT, $object));
 }