diff options
Diffstat (limited to 'lib/private/Settings/Mapper.php')
-rw-r--r-- | lib/private/Settings/Mapper.php | 37 |
1 files changed, 30 insertions, 7 deletions
diff --git a/lib/private/Settings/Mapper.php b/lib/private/Settings/Mapper.php index 7dea1fe3d81..44ba7dd9cbe 100644 --- a/lib/private/Settings/Mapper.php +++ b/lib/private/Settings/Mapper.php @@ -28,6 +28,8 @@ use OCP\IDBConnection; class Mapper { const TABLE_ADMIN_SETTINGS = 'admin_settings'; const TABLE_ADMIN_SECTIONS = 'admin_sections'; + const TABLE_PERSONAL_SETTINGS = 'personal_settings'; + const TABLE_PERSONAL_SECTIONS = 'personal_sections'; /** @var IDBConnection */ private $dbc; @@ -46,9 +48,30 @@ class Mapper { * @return array[] [['class' => string, 'priority' => int], ...] */ public function getAdminSettingsFromDB($section) { + return $this->getSettingsFromDB(self::TABLE_ADMIN_SETTINGS, $section); + } + + /** + * Get the configured personal settings from the database for the provided section + * + * @param string $section + * @return array[] [['class' => string, 'priority' => int], ...] + */ + public function getPersonalSettingsFromDB($section) { + return $this->getSettingsFromDB(self::TABLE_PERSONAL_SETTINGS, $section); + } + + /** + * Get the configured settings from the database for the provided table and section + * + * @param $table + * @param $section + * @return array + */ + private function getSettingsFromDB($table, $section) { $query = $this->dbc->getQueryBuilder(); $query->select(['class', 'priority']) - ->from(self::TABLE_ADMIN_SETTINGS) + ->from($table) ->where($query->expr()->eq('section', $this->dbc->getQueryBuilder()->createParameter('section'))) ->setParameter('section', $section); @@ -76,7 +99,7 @@ class Mapper { } /** - * @param string $table Mapper::TABLE_ADMIN_SECTIONS or Mapper::TABLE_ADMIN_SETTINGS + * @param string $table one of the Mapper::TABLE_* constants * @param array $values */ public function add($table, array $values) { @@ -91,7 +114,7 @@ class Mapper { /** * returns the registered classes in the given table * - * @param $table Mapper::TABLE_ADMIN_SECTIONS or Mapper::TABLE_ADMIN_SETTINGS + * @param string $table one of the Mapper::TABLE_* constants * @return string[] */ public function getClasses($table) { @@ -110,7 +133,7 @@ class Mapper { /** * Check if a class is configured in the database * - * @param string $table Mapper::TABLE_ADMIN_SECTIONS or Mapper::TABLE_ADMIN_SETTINGS + * @param string $table one of the Mapper::TABLE_* constants * @param string $className * @return bool */ @@ -131,8 +154,8 @@ class Mapper { /** * deletes an settings or admin entry from the given table * - * @param $table Mapper::TABLE_ADMIN_SECTIONS or Mapper::TABLE_ADMIN_SETTINGS - * @param $className + * @param string $table one of the Mapper::TABLE_* constants + * @param string $className */ public function remove($table, $className) { $query = $this->dbc->getQueryBuilder(); @@ -143,7 +166,7 @@ class Mapper { } /** - * @param string $table Mapper::TABLE_ADMIN_SECTIONS or Mapper::TABLE_ADMIN_SETTINGS + * @param string $table one of the Mapper::TABLE_* constants * @param string $idCol * @param string $id * @param array $values |