Add a new method getAllUserValues($userId) to IConfig

The method was already there in AllConfig but private

Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
This commit is contained in:
Côme Chilliet 2022-01-18 15:23:08 +01:00
parent 6e47104bb6
commit d630af4ca8
No known key found for this signature in database
GPG key ID: A3E2F658B28C760A
2 changed files with 15 additions and 3 deletions

View file

@ -319,7 +319,7 @@ class AllConfig implements \OCP\IConfig {
* @return string
*/
public function getUserValue($userId, $appName, $key, $default = '') {
$data = $this->getUserValues($userId);
$data = $this->getAllUserValues($userId);
if (isset($data[$appName][$key])) {
return $data[$appName][$key];
} else {
@ -335,7 +335,7 @@ class AllConfig implements \OCP\IConfig {
* @return string[]
*/
public function getUserKeys($userId, $appName) {
$data = $this->getUserValues($userId);
$data = $this->getAllUserValues($userId);
if (isset($data[$appName])) {
return array_keys($data[$appName]);
} else {
@ -406,7 +406,7 @@ class AllConfig implements \OCP\IConfig {
* [ $key => $value ]
* ]
*/
private function getUserValues($userId) {
public function getAllUserValues(string $userId): array {
if (isset($this->userCache[$userId])) {
return $this->userCache[$userId];
}

View file

@ -216,6 +216,18 @@ interface IConfig {
*/
public function getUserKeys($userId, $appName);
/**
* Get all user configs sorted by app of one user
*
* @param string $userId the userId of the user that we want to get all values from
* @return array[] - 2 dimensional array with the following structure:
* [ $appId =>
* [ $key => $value ]
* ]
* @since 24.0.0
*/
public function getAllUserValues(string $userId): array;
/**
* Delete a user value
*