/**
  * {@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;
 }