diff options
author | Georg Ehrke <dev@georgswebsite.de> | 2012-07-18 15:27:31 +0200 |
---|---|---|
committer | Georg Ehrke <dev@georgswebsite.de> | 2012-07-18 15:27:31 +0200 |
commit | 4490a884927c6d17e3a684500761d5cceaab128d (patch) | |
tree | cd25ffbe96489e1b7b57dbdd05351d7ba437dd1e /settings/ajax | |
parent | 1a57d392e9fccdc47136f8e47e80ecf6cfc44b77 (diff) | |
download | nextcloud-server-4490a884927c6d17e3a684500761d5cceaab128d.tar.gz nextcloud-server-4490a884927c6d17e3a684500761d5cceaab128d.zip |
fix changepassword.php for subadmins
Diffstat (limited to 'settings/ajax')
-rw-r--r-- | settings/ajax/changepassword.php | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/settings/ajax/changepassword.php b/settings/ajax/changepassword.php index 4ba6813517b..a5122bdd9d5 100644 --- a/settings/ajax/changepassword.php +++ b/settings/ajax/changepassword.php @@ -11,7 +11,28 @@ $oldPassword=isset($_POST["oldpassword"])?$_POST["oldpassword"]:''; OC_JSON::checkLoggedIn(); OCP\JSON::callCheck(); -if( (!OC_Group::inGroup( OC_User::getUser(), 'admin' ) && ($username!=OC_User::getUser() || !OC_User::checkPassword($username,$oldPassword)))) { +$userstatus = null; +if(OC_Group::inGroup(OC_User::getUser(), 'admin')){ + $userstatus = 'admin'; +} +if(OC_SubAdmin::isSubAdmin(OC_User::getUser())){ + $accessiblegroups = OC_SubAdmin::getSubAdminsGroups(OC_User::getUser()); + $isuseraccessible = false; + foreach($accessiblegroups as $accessiblegroup){ + if(OC_Group::inGroup($username, $accessiblegroup)){ + $isuseraccessible = true; + break; + } + } + if($isuseraccessible){ + $userstatus = 'subadmin'; + } +} +if(OC_User::getUser() == $username && OC_User::checkPassword($username,$oldPassword)){ + $userstatus = 'user'; +} + +if(is_null($userstatus)){ OC_JSON::error( array( "data" => array( "message" => "Authentication error" ))); exit(); } |