Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions apps/user_ldap/lib/User/Manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -163,9 +163,14 @@ function ($list, $attribute) {
* @return bool
*/
public function isDeletedUser($id) {
$isDeleted = $this->ocConfig->getUserValue(
$id, 'user_ldap', 'isDeleted', 0);
return (int)$isDeleted === 1;
try {
$isDeleted = $this->ocConfig->getUserValue($id, 'user_ldap', 'isDeleted', 0);
return (int)$isDeleted === 1;
} catch (\InvalidArgumentException $e) {
// Most likely the string is too long to be a valid user id
$this->logger->debug('Invalid id given to isDeletedUser', ['exception' => $e]);
return false;
}
}

/**
Expand Down
1 change: 1 addition & 0 deletions lib/private/Config/UserConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -1708,6 +1708,7 @@ private function isFlagged(int $needle, int $flags): bool {
* @param bool $allowEmptyUser
* @param bool $allowEmptyApp $app can be empty string
* @param ValueType|null $valueType assert value type is only one type
* @throws InvalidArgumentException if userId, app, or prefKey is invalid (too long, or empty string)
*/
private function assertParams(
string $userId = '',
Expand Down
39 changes: 39 additions & 0 deletions lib/public/Config/IUserConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ interface IUserConfig {
* @param string $appId optional id of app
*
* @return list<string> list of userIds
* @throws \InvalidArgumentException if $appId is invalid (too long)
*
* @since 32.0.0
*/
Expand All @@ -62,6 +63,7 @@ public function getUserIds(string $appId = ''): array;
* @param string $userId id of the user
*
* @return list<string> list of app ids
* @throws \InvalidArgumentException if $userId is invalid (too long, or empty string)
*
* @since 32.0.0
*/
Expand All @@ -77,6 +79,7 @@ public function getApps(string $userId): array;
* @param string $app id of the app
*
* @return list<string> list of stored config keys
* @throws \InvalidArgumentException if $userId or $app is invalid (too long, or empty string)
*
* @since 32.0.0
*/
Expand All @@ -91,6 +94,7 @@ public function getKeys(string $userId, string $app): array;
* @param bool $lazy search within lazy loaded config
*
* @return bool TRUE if key exists
* @throws \InvalidArgumentException if $userId, $app or $key is invalid (too long, or empty string)
*
* @since 32.0.0
*/
Expand All @@ -106,6 +110,7 @@ public function hasKey(string $userId, string $app, string $key, ?bool $lazy = f
*
* @return bool TRUE if value is sensitive
* @throws UnknownKeyException if config key is not known
* @throws \InvalidArgumentException if $userId, $app or $key is invalid (too long, or empty string)
*
* @since 32.0.0
*/
Expand All @@ -126,6 +131,7 @@ public function isSensitive(string $userId, string $app, string $key, ?bool $laz
*
* @return bool TRUE if value is sensitive
* @throws UnknownKeyException if config key is not known
* @throws \InvalidArgumentException if $userId, $app or $key is invalid (too long, or empty string)
*
* @since 32.0.0
*/
Expand All @@ -142,6 +148,7 @@ public function isIndexed(string $userId, string $app, string $key, ?bool $lazy
*
* @return bool TRUE if config is lazy loaded
* @throws UnknownKeyException if config key is not known
* @throws \InvalidArgumentException if $userId, $app or $key is invalid (too long, or empty string)
* @see IUserConfig for details about lazy loading
*
* @since 32.0.0
Expand All @@ -160,6 +167,7 @@ public function isLazy(string $userId, string $app, string $key): bool;
* @param bool $filtered filter sensitive config values
*
* @return array<string, string|int|float|bool|array> [key => value]
* @throws \InvalidArgumentException if $userId, $app or $key is invalid (too long, or empty string)
*
* @since 32.0.0
*/
Expand All @@ -175,6 +183,7 @@ public function getValues(string $userId, string $app, string $prefix = '', bool
* @param bool $filtered filter sensitive config values
*
* @return array<string, string|int|float|bool|array> [key => value]
* @throws \InvalidArgumentException if $userId is invalid (too long, or empty string)
*
* @since 32.0.0
*/
Expand All @@ -190,6 +199,7 @@ public function getAllValues(string $userId, bool $filtered = false): array;
* @param ValueType|null $typedAs enforce type for the returned values
*
* @return array<string, string|int|float|bool|array> [appId => value]
* @throws \InvalidArgumentException if $userId or $key is invalid (too long, or empty string)
*
* @since 32.0.0
*/
Expand All @@ -207,6 +217,7 @@ public function getValuesByApps(string $userId, string $key, bool $lazy = false,
* @param array|null $userIds limit the search to a list of user ids
*
* @return array<string, string|int|float|bool|array> [userId => value]
* @throws \InvalidArgumentException if $app or $key is invalid (too long, or empty string)
*
* @since 32.0.0
*/
Expand All @@ -224,6 +235,7 @@ public function getValuesByUsers(string $app, string $key, ?ValueType $typedAs =
* @param bool $caseInsensitive non-case-sensitive search, only works if $value is a string
*
* @return Generator<string>
* @throws \InvalidArgumentException if $app or $key is invalid (too long, or empty string)
*
* @since 32.0.0
*/
Expand All @@ -240,6 +252,7 @@ public function searchUsersByValueString(string $app, string $key, string $value
* @param int $value config value
*
* @return Generator<string>
* @throws \InvalidArgumentException if $app or $key is invalid (too long, or empty string)
*
* @since 32.0.0
*/
Expand All @@ -256,6 +269,7 @@ public function searchUsersByValueInt(string $app, string $key, int $value): Gen
* @param array $values list of possible config values
*
* @return Generator<string>
* @throws \InvalidArgumentException if $app or $key is invalid (too long, or empty string)
*
* @since 32.0.0
*/
Expand All @@ -272,6 +286,7 @@ public function searchUsersByValues(string $app, string $key, array $values): Ge
* @param bool $value config value
*
* @return Generator<string>
* @throws \InvalidArgumentException if $app or $key is invalid (too long, or empty string)
*
* @since 32.0.0
*/
Expand All @@ -289,6 +304,7 @@ public function searchUsersByValueBool(string $app, string $key, bool $value): G
* @param bool $lazy search within lazy loaded config
*
* @return string stored config value or $default if not set in database
* @throws \InvalidArgumentException if $userId, $app or $key is invalid (too long, or empty string)
*
* @since 32.0.0
*
Expand All @@ -312,6 +328,7 @@ public function getValueString(string $userId, string $app, string $key, string
* @param bool $lazy search within lazy loaded config
*
* @return int stored config value or $default if not set in database
* @throws \InvalidArgumentException if $userId, $app or $key is invalid (too long, or empty string)
*
* @since 32.0.0
*
Expand All @@ -335,6 +352,7 @@ public function getValueInt(string $userId, string $app, string $key, int $defau
* @param bool $lazy search within lazy loaded config
*
* @return float stored config value or $default if not set in database
* @throws \InvalidArgumentException if $userId, $app or $key is invalid (too long, or empty string)
*
* @since 32.0.0
*
Expand All @@ -358,6 +376,7 @@ public function getValueFloat(string $userId, string $app, string $key, float $d
* @param bool $lazy search within lazy loaded config
*
* @return bool stored config value or $default if not set in database
* @throws \InvalidArgumentException if $userId, $app or $key is invalid (too long, or empty string)
*
* @since 32.0.0
*
Expand All @@ -381,6 +400,7 @@ public function getValueBool(string $userId, string $app, string $key, bool $def
* @param bool $lazy search within lazy loaded config
*
* @return array stored config value or $default if not set in database
* @throws \InvalidArgumentException if $userId, $app or $key is invalid (too long, or empty string)
*
* @since 32.0.0
*
Expand All @@ -406,6 +426,7 @@ public function getValueArray(string $userId, string $app, string $key, array $d
* @return ValueType type of the value
* @throws UnknownKeyException if config key is not known
* @throws IncorrectTypeException if config value type is not known
* @throws \InvalidArgumentException if $userId, $app or $key is invalid (too long, or empty string)
*
* @since 32.0.0
*/
Expand All @@ -425,6 +446,7 @@ public function getValueType(string $userId, string $app, string $key, ?bool $la
* @return int a bitflag in relation to the config value
* @throws UnknownKeyException if config key is not known
* @throws IncorrectTypeException if config value type is not known
* @throws \InvalidArgumentException if $userId, $app or $key is invalid (too long, or empty string)
*
* @since 32.0.0
*/
Expand All @@ -446,6 +468,7 @@ public function getValueFlags(string $userId, string $app, string $key, bool $la
* @param bool $lazy set config as lazy loaded
*
* @return bool TRUE if value was different, therefor updated in database
* @throws \InvalidArgumentException if $userId, $app or $key is invalid (too long, or empty string)
*
* @since 32.0.0
*
Expand Down Expand Up @@ -478,6 +501,7 @@ public function setValueString(string $userId, string $app, string $key, string
* @param bool $lazy set config as lazy loaded
*
* @return bool TRUE if value was different, therefor updated in database
* @throws \InvalidArgumentException if $userId, $app or $key is invalid (too long, or empty string)
*
* @since 32.0.0
*
Expand Down Expand Up @@ -505,6 +529,7 @@ public function setValueInt(string $userId, string $app, string $key, int $value
* @param bool $lazy set config as lazy loaded
*
* @return bool TRUE if value was different, therefor updated in database
* @throws \InvalidArgumentException if $userId, $app or $key is invalid (too long, or empty string)
*
* @since 32.0.0
*
Expand All @@ -531,6 +556,7 @@ public function setValueFloat(string $userId, string $app, string $key, float $v
* @param bool $lazy set config as lazy loaded
*
* @return bool TRUE if value was different, therefor updated in database
* @throws \InvalidArgumentException if $userId, $app or $key is invalid (too long, or empty string)
*
* @since 32.0.0
*
Expand Down Expand Up @@ -558,6 +584,7 @@ public function setValueBool(string $userId, string $app, string $key, bool $val
* @param bool $lazy set config as lazy loaded
*
* @return bool TRUE if value was different, therefor updated in database
* @throws \InvalidArgumentException if $userId, $app or $key is invalid (too long, or empty string)
*
* @since 32.0.0
*
Expand All @@ -580,6 +607,7 @@ public function setValueArray(string $userId, string $app, string $key, array $v
* @param bool $sensitive TRUE to set as sensitive, FALSE to unset
*
* @return bool TRUE if database update were necessary
* @throws \InvalidArgumentException if $userId, $app or $key is invalid (too long, or empty string)
*
* @since 32.0.0
*/
Expand All @@ -593,6 +621,7 @@ public function updateSensitive(string $userId, string $app, string $key, bool $
* @param string $app id of the app
* @param string $key config key
* @param bool $sensitive TRUE to set as sensitive, FALSE to unset
* @throws \InvalidArgumentException if $app or $key is invalid (too long, or empty string)
*
* @since 32.0.0
*/
Expand All @@ -610,6 +639,7 @@ public function updateGlobalSensitive(string $app, string $key, bool $sensitive)
* @param bool $indexed TRUE to set as indexed, FALSE to unset
*
* @return bool TRUE if database update were necessary
* @throws \InvalidArgumentException if $userId, $app or $key is invalid (too long, or empty string)
*
* @since 32.0.0
*/
Expand All @@ -623,6 +653,7 @@ public function updateIndexed(string $userId, string $app, string $key, bool $in
* @param string $app id of the app
* @param string $key config key
* @param bool $indexed TRUE to set as indexed, FALSE to unset
* @throws \InvalidArgumentException if $app or $key is invalid (too long, or empty string)
*
* @since 32.0.0
*/
Expand All @@ -637,6 +668,7 @@ public function updateGlobalIndexed(string $app, string $key, bool $indexed): vo
* @param bool $lazy TRUE to set as lazy loaded, FALSE to unset
*
* @return bool TRUE if database update was necessary
* @throws \InvalidArgumentException if $userId, $app or $key is invalid (too long, or empty string)
*
* @since 32.0.0
*/
Expand All @@ -650,6 +682,7 @@ public function updateLazy(string $userId, string $app, string $key, bool $lazy)
* @param string $app id of the app
* @param string $key config key
* @param bool $lazy TRUE to set as lazy loaded, FALSE to unset
* @throws \InvalidArgumentException if $app or $key is invalid (too long, or empty string)
*
* @since 32.0.0
*/
Expand All @@ -676,6 +709,7 @@ public function updateGlobalLazy(string $app, string $key, bool $lazy): void;
*
* @return array
* @throws UnknownKeyException if config key is not known in database
* @throws \InvalidArgumentException if $userId, $app or $key is invalid (too long, or empty string)
*
* @since 32.0.0
*/
Expand All @@ -687,6 +721,7 @@ public function getDetails(string $userId, string $app, string $key): array;
* @param string $userId id of the user
* @param string $app id of the app
* @param string $key config key
* @throws \InvalidArgumentException if $userId, $app or $key is invalid (too long, or empty string)
*
* @since 32.0.0
*/
Expand All @@ -697,6 +732,7 @@ public function deleteUserConfig(string $userId, string $app, string $key): void
*
* @param string $app id of the app
* @param string $key config key
* @throws \InvalidArgumentException if $app or $key is invalid (too long, or empty string)
*
* @since 32.0.0
*/
Expand All @@ -706,6 +742,7 @@ public function deleteKey(string $app, string $key): void;
* delete all config keys linked to an app
*
* @param string $app id of the app
* @throws \InvalidArgumentException if $app is invalid (too long, or empty string)
*
* @since 32.0.0
*/
Expand All @@ -715,6 +752,7 @@ public function deleteApp(string $app): void;
* delete all config keys linked to a user
*
* @param string $userId id of the user
* @throws \InvalidArgumentException if $userId is invalid (too long, or empty string)
*
* @since 32.0.0
*/
Expand All @@ -727,6 +765,7 @@ public function deleteAllUserConfig(string $userId): void;
*
* @param string $userId id of the user
* @param bool $reload set to TRUE to refill cache instantly after clearing it
* @throws \InvalidArgumentException if $userId is invalid (too long, or empty string)
*
* @since 32.0.0
*/
Expand Down
Loading