summaryrefslogtreecommitdiffstats
path: root/lib/private/Remote
diff options
context:
space:
mode:
authorRobin Appelman <robin@icewind.nl>2017-10-19 14:05:02 +0200
committerMorris Jobke <hey@morrisjobke.de>2017-12-08 16:37:14 +0100
commit78a24e3b8148a03a12bf5c93b5a19cb252ea6323 (patch)
treea6458066295c41e0ccd5d8af0e9eaf7aa51b37b4 /lib/private/Remote
parent8b01176f60ee85582d467ca9b66aa8fbecd3e54d (diff)
downloadnextcloud-server-78a24e3b8148a03a12bf5c93b5a19cb252ea6323.tar.gz
nextcloud-server-78a24e3b8148a03a12bf5c93b5a19cb252ea6323.zip
validate user response
Signed-off-by: Robin Appelman <robin@icewind.nl>
Diffstat (limited to 'lib/private/Remote')
-rw-r--r--lib/private/Remote/Api/OCS.php9
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);
}
/**