protected function getOidKey(ObjectIdentity $oid)
 {
     return $oid->getIdentifier() . $oid->getType();
 }
示例#2
0
 /**
  * Retrieve the document associated with the values in the ObjectIdentity
  *
  * @param ObjectIdentity $oid
  * @return \Doctrine\MongoDB\Cursor
  */
 protected function getObjectIdentity(ObjectIdentity $oid)
 {
     $query = array("identifier" => $oid->getIdentifier(), "type" => $oid->getType());
     return $this->connection->selectCollection($this->options['oid_collection'])->findOne($query);
 }
示例#3
0
 /**
  * Gets a key used to store ACL in $this->items collection
  *
  * @param OID $oid
  * @return string
  */
 protected function getKey(OID $oid)
 {
     return $oid->getType() . '!' . $oid->getIdentifier();
 }
示例#4
0
 public function testConstructorWithProxy()
 {
     $id = new ObjectIdentity('fooid', 'Acme\\DemoBundle\\Proxy\\__CG__\\Symfony\\Component\\Security\\Tests\\Acl\\Domain\\TestDomainObject');
     $this->assertEquals('fooid', $id->getIdentifier());
     $this->assertEquals('Acme\\DemoBundle\\Proxy\\__CG__\\Symfony\\Component\\Security\\Tests\\Acl\\Domain\\TestDomainObject', $id->getType());
 }
 public function testConstructor()
 {
     $id = new ObjectIdentity('fooid', 'footype');
     $this->assertEquals('fooid', $id->getIdentifier());
     $this->assertEquals('footype', $id->getType());
 }
示例#6
0
 /**
  * {@inheritdoc}
  */
 public function getAllowedPermissions(ObjectIdentity $oid)
 {
     if ($oid->getType() === ObjectIdentityFactory::ROOT_IDENTITY_TYPE) {
         $result = array_keys($this->permissionToMaskBuilderIdentity);
     } else {
         $config = $this->entityMetadataProvider->getMetadata($oid->getType());
         $result = $config->getPermissions();
         if (empty($result)) {
             $result = array_keys($this->map);
         }
         $metadata = $this->getMetadata($oid);
         if (!$metadata->hasOwner()) {
             foreach ($result as $key => $value) {
                 if (in_array($value, array('ASSIGN', 'SHARE'))) {
                     unset($result[$key]);
                 }
             }
         }
     }
     return $result;
 }
 /**
  * {@inheritdoc}
  */
 public function getAllowedPermissions(ObjectIdentity $oid)
 {
     if ($oid->getType() === ObjectIdentityFactory::ROOT_IDENTITY_TYPE) {
         $result = array_keys($this->permissionToMaskBuilderIdentity);
     } else {
         $config = new EntitySecurityMetadata();
         $result = $config->getPermissions();
         if (empty($result)) {
             $result = array_keys($this->map);
         }
     }
     return $result;
 }