Merge pull request #5854 from nextcloud/improve-personal-page-code
Cleanup code of personal page to use public interfaces
This commit is contained in:
commit
184f25c0d6
2 changed files with 3 additions and 54 deletions
|
@ -118,10 +118,10 @@ class PersonalInfo implements ISettings {
|
|||
'usage' => \OC_Helper::humanFileSize($storageInfo['used']),
|
||||
'usage_relative' => $storageInfo['relative'],
|
||||
'quota' => $storageInfo['quota'],
|
||||
'avatarChangeSupported' => \OC_User::canUserChangeAvatar($uid),
|
||||
'avatarChangeSupported' => $user->canChangeAvatar(),
|
||||
'lookupServerUploadEnabled' => $lookupServerUploadEnabled,
|
||||
'avatarScope' => $userData[AccountManager::PROPERTY_AVATAR]['scope'],
|
||||
'displayNameChangeSupported' => \OC_User::canUserChangeDisplayName($uid),
|
||||
'displayNameChangeSupported' => $user->canChangeDisplayName(),
|
||||
'displayName' => $userData[AccountManager::PROPERTY_DISPLAYNAME]['value'],
|
||||
'displayNameScope' => $userData[AccountManager::PROPERTY_DISPLAYNAME]['scope'],
|
||||
'email' => $userData[AccountManager::PROPERTY_EMAIL]['value'],
|
||||
|
@ -138,7 +138,7 @@ class PersonalInfo implements ISettings {
|
|||
'twitterScope' => $userData[AccountManager::PROPERTY_TWITTER]['scope'],
|
||||
'twitterVerification' => $userData[AccountManager::PROPERTY_TWITTER]['verified'],
|
||||
'groups' => $this->getGroups($user),
|
||||
'passwordChangeSupported' => \OC_User::canUserChangePassword($uid),
|
||||
'passwordChangeSupported' => $user->canChangePassword(),
|
||||
] + $messageParameters + $languageParameters;
|
||||
|
||||
|
||||
|
|
|
@ -411,57 +411,6 @@ class OC_User {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Check whether user can change his avatar
|
||||
*
|
||||
* @param string $uid The username
|
||||
* @return bool
|
||||
*
|
||||
* Check whether a specified user can change his avatar
|
||||
*/
|
||||
public static function canUserChangeAvatar($uid) {
|
||||
$user = \OC::$server->getUserManager()->get($uid);
|
||||
if ($user) {
|
||||
return $user->canChangeAvatar();
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Check whether user can change his password
|
||||
*
|
||||
* @param string $uid The username
|
||||
* @return bool
|
||||
*
|
||||
* Check whether a specified user can change his password
|
||||
*/
|
||||
public static function canUserChangePassword($uid) {
|
||||
$user = \OC::$server->getUserManager()->get($uid);
|
||||
if ($user) {
|
||||
return $user->canChangePassword();
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Check whether user can change his display name
|
||||
*
|
||||
* @param string $uid The username
|
||||
* @return bool
|
||||
*
|
||||
* Check whether a specified user can change his display name
|
||||
*/
|
||||
public static function canUserChangeDisplayName($uid) {
|
||||
$user = \OC::$server->getUserManager()->get($uid);
|
||||
if ($user) {
|
||||
return $user->canChangeDisplayName();
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the password is correct
|
||||
*
|
||||
|
|
Loading…
Reference in a new issue