summaryrefslogtreecommitdiffstats
path: root/settings/ajax
diff options
context:
space:
mode:
authorRoeland Jago Douma <rullzer@owncloud.com>2015-11-08 22:08:19 +0100
committerRoeland Jago Douma <rullzer@owncloud.com>2015-11-20 16:05:43 +0100
commit0265bcfdae6eff2ea87eb0f6de66e2eacb590820 (patch)
tree45333175470f4a822c727ca065bf6e5cadfda424 /settings/ajax
parent427d107b9f375f5667a3e8f40191edd46924fdb8 (diff)
downloadnextcloud-server-0265bcfdae6eff2ea87eb0f6de66e2eacb590820.tar.gz
nextcloud-server-0265bcfdae6eff2ea87eb0f6de66e2eacb590820.zip
Moved changedisplayname to usercontroller
Killed the old static route to change a users display name and moved it to a properly testable controller.
Diffstat (limited to 'settings/ajax')
-rw-r--r--settings/ajax/changedisplayname.php67
1 files changed, 0 insertions, 67 deletions
diff --git a/settings/ajax/changedisplayname.php b/settings/ajax/changedisplayname.php
deleted file mode 100644
index 380cbac43da..00000000000
--- a/settings/ajax/changedisplayname.php
+++ /dev/null
@@ -1,67 +0,0 @@
-<?php
-/**
- * @author Bart Visscher <bartv@thisnet.nl>
- * @author Christopher Schäpers <kondou@ts.unde.re>
- * @author David Reagan <reagand@lanecc.edu>
- * @author Jan-Christoph Borchardt <hey@jancborchardt.net>
- * @author Lukas Reschke <lukas@owncloud.com>
- * @author Robin Appelman <icewind@owncloud.com>
- *
- * @copyright Copyright (c) 2015, ownCloud, Inc.
- * @license AGPL-3.0
- *
- * This code is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License, version 3,
- * as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License, version 3,
- * along with this program. If not, see <http://www.gnu.org/licenses/>
- *
- */
-// Check if we are a user
-
-OCP\JSON::callCheck();
-OC_JSON::checkLoggedIn();
-
-$l = \OC::$server->getL10N('settings');
-
-$username = isset($_POST["username"]) ? $_POST["username"] : OC_User::getUser();
-$displayName = (string)$_POST["displayName"];
-
-$userstatus = null;
-if(OC_User::isAdminUser(OC_User::getUser())) {
- $userstatus = 'admin';
-}
-
-$isUserAccessible = false;
-$subadminUserObject = \OC::$server->getUserManager()->get(\OC_User::getUser());
-$targetUserObject = \OC::$server->getUserManager()->get($username);
-if($subadminUserObject !== null && $targetUserObject !== null) {
- $isUserAccessible = \OC::$server->getGroupManager()->getSubAdmin()->isUserAccessible($subadminUserObject, $targetUserObject);
-}
-
-if($isUserAccessible) {
- $userstatus = 'subadmin';
-}
-
-if ($username === OC_User::getUser() && OC_User::canUserChangeDisplayName($username)) {
- $userstatus = 'changeOwnDisplayName';
-}
-
-if(is_null($userstatus)) {
- OC_JSON::error( array( "data" => array( "message" => $l->t("Authentication error") )));
- exit();
-}
-
-// Return Success story
-if( OC_User::setDisplayName( $username, $displayName )) {
- OC_JSON::success(array("data" => array( "message" => $l->t('Your full name has been changed.'), "username" => $username, 'displayName' => $displayName )));
-}
-else{
- OC_JSON::error(array("data" => array( "message" => $l->t("Unable to change full name"), 'displayName' => OC_User::getDisplayName($username) )));
-}