diff options
author | Lukas Reschke <lukas@owncloud.com> | 2014-08-31 15:21:09 +0200 |
---|---|---|
committer | Lukas Reschke <lukas@owncloud.com> | 2014-08-31 15:21:09 +0200 |
commit | ae3425d2dadbac69e7dcb0ba577db20e63e7d91f (patch) | |
tree | f483759739cd951c33ef1c61ade8694f9e1c95e3 /lib/private/user | |
parent | 3329e0f2b22207a24ddb4953bbf11964b23682d9 (diff) | |
parent | 73685892ed6f255a916512863cd5549914d071e1 (diff) | |
download | nextcloud-server-ae3425d2dadbac69e7dcb0ba577db20e63e7d91f.tar.gz nextcloud-server-ae3425d2dadbac69e7dcb0ba577db20e63e7d91f.zip |
Merge branch 'master' into securityutils
Conflicts:
lib/private/util.php
Diffstat (limited to 'lib/private/user')
-rw-r--r-- | lib/private/user/database.php | 4 | ||||
-rw-r--r-- | lib/private/user/manager.php | 2 | ||||
-rw-r--r-- | lib/private/user/session.php | 44 |
3 files changed, 44 insertions, 6 deletions
diff --git a/lib/private/user/database.php b/lib/private/user/database.php index e9844f0f79c..3a76adbe763 100644 --- a/lib/private/user/database.php +++ b/lib/private/user/database.php @@ -157,7 +157,7 @@ class OC_User_Database extends OC_User_Backend { $displayNames = array(); $query = OC_DB::prepare('SELECT `uid`, `displayname` FROM `*PREFIX*users`' . ' WHERE LOWER(`displayname`) LIKE LOWER(?) OR ' - . 'LOWER(`uid`) LIKE LOWER(?)', $limit, $offset); + . 'LOWER(`uid`) LIKE LOWER(?) ORDER BY `uid` ASC', $limit, $offset); $result = $query->execute(array('%' . $search . '%', '%' . $search . '%')); $users = array(); while ($row = $result->fetchRow()) { @@ -231,7 +231,7 @@ class OC_User_Database extends OC_User_Backend { * Get a list of all users. */ public function getUsers($search = '', $limit = null, $offset = null) { - $query = OC_DB::prepare('SELECT `uid` FROM `*PREFIX*users` WHERE LOWER(`uid`) LIKE LOWER(?)', $limit, $offset); + $query = OC_DB::prepare('SELECT `uid` FROM `*PREFIX*users` WHERE LOWER(`uid`) LIKE LOWER(?) ORDER BY `uid` ASC', $limit, $offset); $result = $query->execute(array('%' . $search . '%')); $users = array(); while ($row = $result->fetchRow()) { diff --git a/lib/private/user/manager.php b/lib/private/user/manager.php index a54755e71c5..5c155c27aba 100644 --- a/lib/private/user/manager.php +++ b/lib/private/user/manager.php @@ -237,7 +237,7 @@ class Manager extends PublicEmitter implements IUserManager { * @return bool|\OC\User\User the created user of false */ public function createUser($uid, $password) { - $l = \OC_L10N::get('lib'); + $l = \OC::$server->getL10N('lib'); // Check the name for bad characters // Allowed are: "a-z", "A-Z", "0-9" and "_.@-" if (preg_match('/[^a-zA-Z0-9 _\.@\-]/', $uid)) { diff --git a/lib/private/user/session.php b/lib/private/user/session.php index 6abf8fb80d2..11938db5076 100644 --- a/lib/private/user/session.php +++ b/lib/private/user/session.php @@ -47,10 +47,10 @@ class Session implements IUserSession, Emitter { protected $activeUser; /** - * @param \OC\User\Manager $manager - * @param \OC\Session\Session $session + * @param \OCP\IUserManager $manager + * @param \OCP\ISession $session */ - public function __construct($manager, $session) { + public function __construct(\OCP\IUserManager $manager, \OCP\ISession $session) { $this->manager = $manager; $this->session = $session; } @@ -83,6 +83,44 @@ class Session implements IUserSession, Emitter { } /** + * get the session object + * + * @return \OCP\ISession + */ + public function getSession() { + // fetch the deprecated \OC::$session if it changed for backwards compatibility + if (isset(\OC::$session) && \OC::$session !== $this->session) { + \OC::$server->getLogger()->warning( + 'One of your installed apps still seems to use the deprecated '. + '\OC::$session and has replaced it with a new instance. Please file a bug against it.'. + 'Closing and replacing session in UserSession instance.' + ); + $this->setSession(\OC::$session); + } + return $this->session; + } + + /** + * set the session object + * + * @param \OCP\ISession $session + */ + public function setSession(\OCP\ISession $session) { + if ($this->session instanceof \OCP\ISession) { + $this->session->close(); + } + $this->session = $session; + + // maintain deprecated \OC::$session + if (\OC::$session !== $this->session) { + if (\OC::$session instanceof \OCP\ISession) { + \OC::$session->close(); + } + \OC::$session = $session; + } + } + + /** * set the currently active user * * @param \OC\User\User|null $user |