Esempio n. 1
0
 /**
  * Fills descendants simple rights by simple rights of object.
  * @internal
  * @param int $objectId Id of object.
  */
 public static function fillDescendants($objectId)
 {
     $tableName = static::getTableName();
     $pathTableName = ObjectPathTable::getTableName();
     $connection = Application::getConnection();
     $objectId = (int) $objectId;
     $connection->queryExecute("\n\t\t\tINSERT INTO {$tableName} (OBJECT_ID, ACCESS_CODE)\n\t\t\tSELECT path.OBJECT_ID, sright.ACCESS_CODE FROM {$pathTableName} path\n\t\t\t\tINNER JOIN {$tableName} sright ON sright.OBJECT_ID = path.PARENT_ID\n\t\t\tWHERE path.PARENT_ID = {$objectId}\n\t\t");
 }
Esempio n. 2
0
 private function deleteSimpleFromSelfAndChildren()
 {
     $connection = Application::getInstance()->getConnection();
     $objectId = (int) $this->object->getId();
     $simpleTable = SimpleRightTable::getTableName();
     if ($this->object instanceof File) {
         $sql = "DELETE FROM {$simpleTable} WHERE OBJECT_ID = {$objectId}";
     } else {
         $pathTable = ObjectPathTable::getTableName();
         if ($connection instanceof MysqlCommonConnection || $connection instanceof MssqlConnection) {
             $sql = "DELETE sr FROM {$simpleTable} sr\n\t\t\t\t\t\t\tJOIN {$pathTable} path ON path.OBJECT_ID = sr.OBJECT_ID\n\t\t\t\t\t\tWHERE path.PARENT_ID = {$objectId}\n\t\t\t\t";
         } elseif ($connection instanceof OracleConnection) {
             $sql = "DELETE FROM {$simpleTable}\n\t\t\t\t\t\tWHERE ID IN (\n\t\t\t\t\t\t\tSELECT sr.ID FROM {$simpleTable} sr\n\t\t\t\t\t\t\t\tJOIN {$pathTable} path ON path.OBJECT_ID = sr.OBJECT_ID\n\t\t\t\t\t\t\tWHERE path.PARENT_ID = {$objectId}\n\t\t\t\t\t\t)\n\t\t\t\t";
         }
     }
     $connection->queryExecute($sql);
 }