diff options
Diffstat (limited to 'lib/private/Remote')
-rw-r--r-- | lib/private/Remote/Api/OCS.php | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/private/Remote/Api/OCS.php b/lib/private/Remote/Api/OCS.php index 427a5adcd96..5ce56621a71 100644 --- a/lib/private/Remote/Api/OCS.php +++ b/lib/private/Remote/Api/OCS.php @@ -70,7 +70,14 @@ class OCS extends ApiBase implements ICapabilitiesApi, IUserApi { } public function getUser($userId) { - return new User($this->request('get', 'cloud/users/' . $userId)); + $result = $this->request('get', 'cloud/users/' . $userId); + $keys = ['id', 'email', 'displayname', 'phone', 'address', 'website', 'groups', 'language', 'quota']; + foreach ($keys as $key) { + if (!isset($result[$key])) { + throw new \Exception('Invalid user response, expected field ' . $key . ' not found'); + } + } + return new User($result); } /** |