From 5221ee0c5aaca5588e20683f397fec9d1d6e98c7 Mon Sep 17 00:00:00 2001 From: Arthur Schiwon Date: Tue, 5 Feb 2013 14:58:35 +0100 Subject: offer change password only when the action is supported by the user backend --- lib/user.php | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'lib/user.php') diff --git a/lib/user.php b/lib/user.php index 38259bceea5..f953d221543 100644 --- a/lib/user.php +++ b/lib/user.php @@ -419,6 +419,24 @@ class OC_User { } } + /** + * @brief Check whether user can change his password + * @param $uid The username + * @returns true/false + * + * Check whether a specified user can change his password + */ + public static function canUserChangePassword($uid) { + foreach(self::$_usedBackends as $backend) { + if($backend->implementsActions(OC_USER_BACKEND_SET_PASSWORD)) { + if($backend->userExists($uid)) { + return true; + } + } + } + return false; + } + /** * @brief Check if the password is correct * @param $uid The username -- cgit v1.2.3