This file is indexed.

/usr/share/php/Horde/Perms/Permission/Sql.php is in php-horde-perms 2.1.7-2.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
<?php
/**
 * Extension of the Horde_Permission class for storing permission
 * information in the SQL driver.
 *
 * Copyright 2008-2016 Horde LLC (http://www.horde.org/)
 *
 * See the enclosed file COPYING for license information (LGPL). If you
 * did not receive this file, see http://www.horde.org/licenses/lgpl21.
 *
 * @author   Duck <duck@obala.net>
 * @category Horde
 * @package  Perms
 */
class Horde_Perms_Permission_Sql extends Horde_Perms_Permission
{
    /**
     * The string permission id.
     *
     * @var string
     */
    protected $_id;

    /**
     * Cache object.
     *
     * @var Horde_Cache
     */
    protected $_cache;

    /**
     * Database handle for saving changes.
     *
     * @var Horde_Db_Adapter
     */
    protected $_db;

    /**
     * Tasks to run on serialize().
     *
     * @return array  Parameters that are stored.
     */
    public function __sleep()
    {
        return array_diff(array_keys(get_class_vars(__CLASS__)), array('_cache', '_db'));
    }

    /**
     * Sets the helper functions within the object.
     *
     * @param Horde_Cache $cache    The cache object.
     * @param Horde_Db_Adapter $db  The database object.
     */
    public function setObs(Horde_Cache $cache, Horde_Db_Adapter $db)
    {
        $this->_cache = $cache;
        $this->_db = $db;
    }

    /**
     * Get permission ID.
     *
     * @return TODO
     */
    public function getId()
    {
        return $this->_id;
    }

    /**
     * Set permission id.
     *
     * @param string $id  Permission ID.
     */
    public function setId($id)
    {
        $this->_id = $id;
    }

    /**
     * Saves any changes to this object to the backend permanently. New
     * objects are added instead.
     *
     * @throws Horde_Perms_Exception
     */
    public function save()
    {
        if (!isset($this->_db)) {
            throw new Horde_Perms_Exception('Cannot save because the DB instances has not been set in this object.');
        }

        $name = $this->getName();
        if (empty($name)) {
            throw new Horde_Perms_Exception('Permission names must be non-empty');
        }

        $query = 'UPDATE horde_perms SET perm_data = ? WHERE perm_id = ?';
        $params = array(serialize($this->data), $this->getId());

        try {
            $this->_db->update($query, $params);
        } catch (Horde_Db_Exception $e) {
            throw new Horde_Perms_Exception($e);
        }

        $this->_cache->expire('perm_sql_' . $this->_cacheVersion . $name);
        $this->_cache->expire('perm_sql_exists_' . $this->_cacheVersion . $name);
    }

}