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
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
die_coolen_jungs
our_own_cloud_project
Commits
47ed6a51
Commit
47ed6a51
authored
11 years ago
by
Andreas Fischer
Browse files
Options
Downloads
Patches
Plain Diff
Move backend finding into its own method.
parent
131d82e4
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
lib/private/user.php
+26
-16
26 additions, 16 deletions
lib/private/user.php
with
26 additions
and
16 deletions
lib/private/user.php
+
26
−
16
View file @
47ed6a51
...
...
@@ -247,18 +247,15 @@ class OC_User {
* null: not handled / no backend available
*/
public
static
function
handleApacheAuth
()
{
foreach
(
self
::
$_usedBackends
as
$backend
)
{
if
(
$backend
instanceof
OCP\Authentication\IApacheBackend
)
{
if
(
$backend
->
isSessionActive
())
{
OC_App
::
loadApps
();
$backend
=
self
::
findFirstActiveUsedBackend
();
if
(
$backend
)
{
OC_App
::
loadApps
();
//setup extra user backends
self
::
setupBackends
();
self
::
unsetMagicInCookie
();
//setup extra user backends
self
::
setupBackends
();
self
::
unsetMagicInCookie
();
return
self
::
loginWithApache
(
$backend
);
}
}
return
self
::
loginWithApache
(
$backend
);
}
return
null
;
...
...
@@ -319,12 +316,9 @@ class OC_User {
* @return string with one or more HTML attributes.
*/
public
static
function
getLogoutAttribute
()
{
foreach
(
self
::
$_usedBackends
as
$backend
)
{
if
(
$backend
instanceof
OCP\Authentication\IApacheBackend
)
{
if
(
$backend
->
isSessionActive
())
{
return
$backend
->
getLogoutAttribute
();
}
}
$backend
=
self
::
findFirstActiveUsedBackend
();
if
(
$backend
)
{
return
$backend
->
getLogoutAttribute
();
}
return
"href="
.
link_to
(
''
,
'index.php'
)
.
"?logout=true"
;
...
...
@@ -568,4 +562,20 @@ class OC_User {
public
static
function
unsetMagicInCookie
()
{
self
::
getUserSession
()
->
unsetMagicInCookie
();
}
/**
* @brief Returns the first active backend from self::$_usedBackends.
* @return null if no backend active, otherwise OCP\Authentication\IApacheBackend
*/
private
static
function
findFirstActiveUsedBackend
()
{
foreach
(
self
::
$_usedBackends
as
$backend
)
{
if
(
$backend
instanceof
OCP\Authentication\IApacheBackend
)
{
if
(
$backend
->
isSessionActive
())
{
return
$backend
;
}
}
}
return
null
;
}
}
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