Constants

SENSITIVE_VALUE

SENSITIVE_VALUE

Methods

setSystemValues()

setSystemValues(array  $configs) 

Sets and deletes system wide values

Parameters

array $configs

Associative array with key => value pairs If value is null, the config key will be deleted

setSystemValue()

setSystemValue(string  $key, mixed  $value) 

Sets a new system wide value

Parameters

string $key

the key of the value, under which will be saved

mixed $value

the value that should be stored

getSystemValue()

getSystemValue(string  $key, mixed  $default = '') : mixed

Looks up a system wide defined value

Parameters

string $key

the key of the value, under which it was saved

mixed $default

the default value to be returned if the value isn't set

Returns

mixed —

the value or $default

getFilteredSystemValue()

getFilteredSystemValue(string  $key, mixed  $default = '') : mixed

Looks up a system wide defined value and filters out sensitive data

Parameters

string $key

the key of the value, under which it was saved

mixed $default

the default value to be returned if the value isn't set

Returns

mixed —

the value or $default

deleteSystemValue()

deleteSystemValue(string  $key) 

Delete a system wide defined value

Parameters

string $key

the key of the value, under which it was saved

getAppKeys()

getAppKeys(string  $appName) : array<mixed,string>

Get all keys stored for an app

Parameters

string $appName

the appName that we stored the value under

Returns

array<mixed,string> —

the keys stored for the app

setAppValue()

setAppValue(string  $appName, string|float|integer  $key, string  $value) : void

Writes a new app wide value

Parameters

string $appName

the appName that we want to store the value under

string|float|integer $key

the key of the value, under which will be saved

string $value

the value that should be stored

getAppValue()

getAppValue(string  $appName, string  $key, string  $default = '') : string

Looks up an app wide defined value

Parameters

string $appName

the appName that we stored the value under

string $key

the key of the value, under which it was saved

string $default

the default value to be returned if the value isn't set

Returns

string —

the saved value

deleteAppValue()

deleteAppValue(string  $appName, string  $key) 

Delete an app wide defined value

Parameters

string $appName

the appName that we stored the value under

string $key

the key of the value, under which it was saved

deleteAppValues()

deleteAppValues(string  $appName) 

Removes all keys in appconfig belonging to the app

Parameters

string $appName

the appName the configs are stored under

setUserValue()

setUserValue(string  $userId, string  $appName, string  $key, string  $value, string  $preCondition = null) 

Set a user defined value

Parameters

string $userId

the userId of the user that we want to store the value under

string $appName

the appName that we want to store the value under

string $key

the key under which the value is being stored

string $value

the value that you want to store

string $preCondition

only update if the config value was previously the value passed as $preCondition

Throws

\OCP\PreConditionNotMetException

if a precondition is specified and is not met

\UnexpectedValueException

when trying to store an unexpected value

getUserValue()

getUserValue(string  $userId, string  $appName, string  $key, mixed  $default = '') : string

Shortcut for getting a user defined value

Parameters

string $userId

the userId of the user that we want to store the value under

string $appName

the appName that we stored the value under

string $key

the key under which the value is being stored

mixed $default

the default value to be returned if the value isn't set

Returns

string

getUserValueForUsers()

getUserValueForUsers(string  $appName, string  $key, array  $userIds) : array

Fetches a mapped list of userId -> value, for a specified app and key and a list of user IDs.

Parameters

string $appName

app to get the value for

string $key

the key to get the value for

array $userIds

the user IDs to fetch the values for

Returns

array —

Mapped values: userId => value

getUserKeys()

getUserKeys(string  $userId, string  $appName) : array<mixed,string>

Get the keys of all stored by an app for the user

Parameters

string $userId

the userId of the user that we want to store the value under

string $appName

the appName that we stored the value under

Returns

array<mixed,string>

deleteUserValue()

deleteUserValue(string  $userId, string  $appName, string  $key) 

Delete a user value

Parameters

string $userId

the userId of the user that we want to store the value under

string $appName

the appName that we stored the value under

string $key

the key under which the value is being stored

deleteAllUserValues()

deleteAllUserValues(string  $userId) 

Delete all user values

Parameters

string $userId

the userId of the user that we want to remove all values from

deleteAppFromAllUsers()

deleteAppFromAllUsers(string  $appName) 

Delete all user related values of one app

Parameters

string $appName

the appName of the app that we want to remove all values from

getUsersForUserValue()

getUsersForUserValue(string  $appName, string  $key, string  $value) : array

Determines the users that have the given value set for a specific app-key-pair

Parameters

string $appName

the app to get the user for

string $key

the key to get the user for

string $value

the value to get the user for

Returns

array —

of user IDs