Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[stable11] Fix the storage info and other checks when the user has wrong casing #4459

Merged
merged 1 commit into from
Apr 24, 2017
Merged
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
14 changes: 7 additions & 7 deletions apps/provisioning_api/lib/Controller/UsersController.php
Original file line number Diff line number Diff line change
Expand Up @@ -243,10 +243,10 @@ protected function getUserData($userId) {
// Admin? Or SubAdmin?
if($this->groupManager->isAdmin($currentLoggedInUser->getUID())
|| $this->groupManager->getSubAdmin()->isUserAccessible($currentLoggedInUser, $targetUserObject)) {
$data['enabled'] = $this->config->getUserValue($userId, 'core', 'enabled', 'true');
$data['enabled'] = $this->config->getUserValue($targetUserObject->getUID(), 'core', 'enabled', 'true');
} else {
// Check they are looking up themselves
if($currentLoggedInUser->getUID() !== $userId) {
if($currentLoggedInUser->getUID() !== $targetUserObject->getUID()) {
throw new OCSException('', \OCP\API::RESPOND_UNAUTHORISED);
}
}
Expand All @@ -255,7 +255,7 @@ protected function getUserData($userId) {

// Find the data
$data['id'] = $targetUserObject->getUID();
$data['quota'] = $this->fillStorageInfo($userId);
$data['quota'] = $this->fillStorageInfo($targetUserObject->getUID());
$data['email'] = $targetUserObject->getEMailAddress();
$data['displayname'] = $targetUserObject->getDisplayName();
$data['phone'] = $userAccount[\OC\Accounts\AccountManager::PROPERTY_PHONE]['value'];
Expand Down Expand Up @@ -289,7 +289,7 @@ public function editUser($userId, $key, $value) {
}

$permittedFields = [];
if($userId === $currentLoggedInUser->getUID()) {
if($targetUser->getUID() === $currentLoggedInUser->getUID()) {
// Editing self (display, email)
$permittedFields[] = 'display';
$permittedFields[] = 'email';
Expand Down Expand Up @@ -545,9 +545,9 @@ public function removeFromGroup($userId, $groupid) {
throw new OCSException('', 104);
}
// Check they aren't removing themselves from 'admin' or their 'subadmin; group
if($userId === $loggedInUser->getUID()) {
if($this->groupManager->isAdmin($loggedInUser->getUID())) {
if($group->getGID() === 'admin') {
if ($targetUser->getUID() === $loggedInUser->getUID()) {
if ($this->groupManager->isAdmin($loggedInUser->getUID())) {
if ($group->getGID() === 'admin') {
throw new OCSException('Cannot remove yourself from the admin group', 105);
}
} else {
Expand Down
Loading