Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
our_own_cloud_project
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
die_coolen_jungs
our_own_cloud_project
Commits
434835b3
Commit
434835b3
authored
10 years ago
by
Robin Appelman
Browse files
Options
Downloads
Patches
Plain Diff
also set user in UserSession when doing OC_User::setUserId
parent
4d805b52
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
lib/private/user.php
+36
-5
36 additions, 5 deletions
lib/private/user.php
with
36 additions
and
5 deletions
lib/private/user.php
+
36
−
5
View file @
434835b3
...
@@ -64,6 +64,7 @@ class OC_User {
...
@@ -64,6 +64,7 @@ class OC_User {
/**
/**
* registers backend
* registers backend
*
* @param string $backend name of the backend
* @param string $backend name of the backend
* @deprecated Add classes by calling OC_User::useBackend() with a class instance instead
* @deprecated Add classes by calling OC_User::useBackend() with a class instance instead
* @return bool
* @return bool
...
@@ -77,6 +78,7 @@ class OC_User {
...
@@ -77,6 +78,7 @@ class OC_User {
/**
/**
* gets available backends
* gets available backends
*
* @deprecated
* @deprecated
* @return array an array of backends
* @return array an array of backends
*
*
...
@@ -88,6 +90,7 @@ class OC_User {
...
@@ -88,6 +90,7 @@ class OC_User {
/**
/**
* gets used backends
* gets used backends
*
* @deprecated
* @deprecated
* @return array an array of backends
* @return array an array of backends
*
*
...
@@ -99,6 +102,7 @@ class OC_User {
...
@@ -99,6 +102,7 @@ class OC_User {
/**
/**
* Adds the backend to the list of used backends
* Adds the backend to the list of used backends
*
* @param string|OC_User_Interface $backend default: database The backend to use for user management
* @param string|OC_User_Interface $backend default: database The backend to use for user management
* @return bool
* @return bool
*
*
...
@@ -171,6 +175,7 @@ class OC_User {
...
@@ -171,6 +175,7 @@ class OC_User {
/**
/**
* Create a new user
* Create a new user
*
* @param string $uid The username of the user to create
* @param string $uid The username of the user to create
* @param string $password The password of the new user
* @param string $password The password of the new user
* @throws Exception
* @throws Exception
...
@@ -188,6 +193,7 @@ class OC_User {
...
@@ -188,6 +193,7 @@ class OC_User {
/**
/**
* delete a user
* delete a user
*
* @param string $uid The username of the user to delete
* @param string $uid The username of the user to delete
* @return bool
* @return bool
*
*
...
@@ -205,6 +211,7 @@ class OC_User {
...
@@ -205,6 +211,7 @@ class OC_User {
/**
/**
* Try to login a user
* Try to login a user
*
* @param string $loginname The login name of the user to log in
* @param string $loginname The login name of the user to log in
* @param string $password The password of the user
* @param string $password The password of the user
* @return boolean|null
* @return boolean|null
...
@@ -286,11 +293,18 @@ class OC_User {
...
@@ -286,11 +293,18 @@ class OC_User {
* Sets user id for session and triggers emit
* Sets user id for session and triggers emit
*/
*/
public
static
function
setUserId
(
$uid
)
{
public
static
function
setUserId
(
$uid
)
{
$userSession
=
\OC
::
$server
->
getUserSession
();
$userManager
=
\OC
::
$server
->
getUserManager
();
if
(
$user
=
$userManager
->
get
(
$uid
))
{
$userSession
->
setUser
(
$user
);
}
else
{
\OC
::
$server
->
getSession
()
->
set
(
'user_id'
,
$uid
);
\OC
::
$server
->
getSession
()
->
set
(
'user_id'
,
$uid
);
}
}
}
/**
/**
* Sets user display name for session
* Sets user display name for session
*
* @param string $uid
* @param string $uid
* @param null $displayName
* @param null $displayName
* @return bool Whether the display name could get set
* @return bool Whether the display name could get set
...
@@ -327,6 +341,7 @@ class OC_User {
...
@@ -327,6 +341,7 @@ class OC_User {
/**
/**
* Check if the user is logged in, considers also the HTTP basic credentials
* Check if the user is logged in, considers also the HTTP basic credentials
*
* @return bool
* @return bool
*/
*/
public
static
function
isLoggedIn
()
{
public
static
function
isLoggedIn
()
{
...
@@ -339,6 +354,7 @@ class OC_User {
...
@@ -339,6 +354,7 @@ class OC_User {
/**
/**
* set incognito mode, e.g. if a user wants to open a public link
* set incognito mode, e.g. if a user wants to open a public link
*
* @param bool $status
* @param bool $status
*/
*/
public
static
function
setIncognitoMode
(
$status
)
{
public
static
function
setIncognitoMode
(
$status
)
{
...
@@ -347,6 +363,7 @@ class OC_User {
...
@@ -347,6 +363,7 @@ class OC_User {
/**
/**
* get incognito mode status
* get incognito mode status
*
* @return bool
* @return bool
*/
*/
public
static
function
isIncognitoMode
()
{
public
static
function
isIncognitoMode
()
{
...
@@ -371,6 +388,7 @@ class OC_User {
...
@@ -371,6 +388,7 @@ class OC_User {
/**
/**
* Check if the user is an admin user
* Check if the user is an admin user
*
* @param string $uid uid of the admin
* @param string $uid uid of the admin
* @return bool
* @return bool
*/
*/
...
@@ -384,6 +402,7 @@ class OC_User {
...
@@ -384,6 +402,7 @@ class OC_User {
/**
/**
* get the user id of the user currently logged in.
* get the user id of the user currently logged in.
*
* @return string uid or false
* @return string uid or false
*/
*/
public
static
function
getUser
()
{
public
static
function
getUser
()
{
...
@@ -397,6 +416,7 @@ class OC_User {
...
@@ -397,6 +416,7 @@ class OC_User {
/**
/**
* get the display name of the user currently logged in.
* get the display name of the user currently logged in.
*
* @param string $uid
* @param string $uid
* @return string uid or false
* @return string uid or false
*/
*/
...
@@ -420,6 +440,7 @@ class OC_User {
...
@@ -420,6 +440,7 @@ class OC_User {
/**
/**
* Autogenerate a password
* Autogenerate a password
*
* @return string
* @return string
*
*
* generates a password
* generates a password
...
@@ -430,6 +451,7 @@ class OC_User {
...
@@ -430,6 +451,7 @@ class OC_User {
/**
/**
* Set password
* Set password
*
* @param string $uid The username
* @param string $uid The username
* @param string $password The new password
* @param string $password The new password
* @param string $recoveryPassword for the encryption app to reset encryption keys
* @param string $recoveryPassword for the encryption app to reset encryption keys
...
@@ -448,6 +470,7 @@ class OC_User {
...
@@ -448,6 +470,7 @@ class OC_User {
/**
/**
* Check whether user can change his avatar
* Check whether user can change his avatar
*
* @param string $uid The username
* @param string $uid The username
* @return bool
* @return bool
*
*
...
@@ -464,6 +487,7 @@ class OC_User {
...
@@ -464,6 +487,7 @@ class OC_User {
/**
/**
* Check whether user can change his password
* Check whether user can change his password
*
* @param string $uid The username
* @param string $uid The username
* @return bool
* @return bool
*
*
...
@@ -480,6 +504,7 @@ class OC_User {
...
@@ -480,6 +504,7 @@ class OC_User {
/**
/**
* Check whether user can change his display name
* Check whether user can change his display name
*
* @param string $uid The username
* @param string $uid The username
* @return bool
* @return bool
*
*
...
@@ -496,6 +521,7 @@ class OC_User {
...
@@ -496,6 +521,7 @@ class OC_User {
/**
/**
* Check if the password is correct
* Check if the password is correct
*
* @param string $uid The username
* @param string $uid The username
* @param string $password The password
* @param string $password The password
* @return string|false user id a string on success, false otherwise
* @return string|false user id a string on success, false otherwise
...
@@ -530,6 +556,7 @@ class OC_User {
...
@@ -530,6 +556,7 @@ class OC_User {
/**
/**
* Get a list of all users
* Get a list of all users
*
* @return array an array of all uids
* @return array an array of all uids
*
*
* Get a list of all users.
* Get a list of all users.
...
@@ -548,6 +575,7 @@ class OC_User {
...
@@ -548,6 +575,7 @@ class OC_User {
/**
/**
* Get a list of all users display name
* Get a list of all users display name
*
* @param string $search
* @param string $search
* @param int $limit
* @param int $limit
* @param int $offset
* @param int $offset
...
@@ -567,6 +595,7 @@ class OC_User {
...
@@ -567,6 +595,7 @@ class OC_User {
/**
/**
* check if a user exists
* check if a user exists
*
* @param string $uid the username
* @param string $uid the username
* @return boolean
* @return boolean
*/
*/
...
@@ -615,6 +644,7 @@ class OC_User {
...
@@ -615,6 +644,7 @@ class OC_User {
/**
/**
* Set cookie value to use in next page load
* Set cookie value to use in next page load
*
* @param string $username username to be set
* @param string $username username to be set
* @param string $token
* @param string $token
*/
*/
...
@@ -631,6 +661,7 @@ class OC_User {
...
@@ -631,6 +661,7 @@ class OC_User {
/**
/**
* Returns the first active backend from self::$_usedBackends.
* Returns the first active backend from self::$_usedBackends.
*
* @return OCP\Authentication\IApacheBackend|null if no backend active, otherwise OCP\Authentication\IApacheBackend
* @return OCP\Authentication\IApacheBackend|null if no backend active, otherwise OCP\Authentication\IApacheBackend
*/
*/
private
static
function
findFirstActiveUsedBackend
()
{
private
static
function
findFirstActiveUsedBackend
()
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment