Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
O
osticket
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
docker
osticket
Commits
680d96d0
Commit
680d96d0
authored
11 years ago
by
Peter Rotich
Browse files
Options
Downloads
Patches
Plain Diff
Provide facility to get the auth backend for the authenticated user
Reafactor logOut to use the piggyback on auth backend
parent
4d1eb53c
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
include/class.auth.php
+19
-7
19 additions, 7 deletions
include/class.auth.php
include/class.client.php
+3
-2
3 additions, 2 deletions
include/class.client.php
include/class.staff.php
+3
-2
3 additions, 2 deletions
include/class.staff.php
with
25 additions
and
11 deletions
include/class.auth.php
+
19
−
7
View file @
680d96d0
...
@@ -11,8 +11,11 @@ abstract class AuthenticatedUser {
...
@@ -11,8 +11,11 @@ abstract class AuthenticatedUser {
abstract
function
getId
();
abstract
function
getId
();
abstract
function
getUsername
();
abstract
function
getUsername
();
abstract
function
getRole
();
abstract
function
getRole
();
abstract
function
logOut
();
//Backend used to authenticate the user
abstract
function
getAuthBackend
();
//Authentication key
function
setAuthKey
(
$key
)
{
function
setAuthKey
(
$key
)
{
$this
->
authkey
=
$key
;
$this
->
authkey
=
$key
;
}
}
...
@@ -20,6 +23,15 @@ abstract class AuthenticatedUser {
...
@@ -20,6 +23,15 @@ abstract class AuthenticatedUser {
function
getAuthKey
()
{
function
getAuthKey
()
{
return
$this
->
authkey
;
return
$this
->
authkey
;
}
}
// logOut the user
function
logOut
()
{
if
(
$bk
=
$this
->
getAuthBackend
())
return
$bk
->
signOut
(
$this
);
return
false
;
}
}
}
interface
AuthDirectorySearch
{
interface
AuthDirectorySearch
{
...
@@ -293,12 +305,15 @@ abstract class StaffAuthenticationBackend extends AuthenticationBackend {
...
@@ -293,12 +305,15 @@ abstract class StaffAuthenticationBackend extends AuthenticationBackend {
return
true
;
return
true
;
}
}
/* Base signOut
*
* Backend should extend the signout and perform any additional signout
* it requires.
*/
static
function
signOut
(
$staff
)
{
static
function
signOut
(
$staff
)
{
global
$ost
;
global
$ost
;
list
(
$id
,
$auth
)
=
explode
(
':'
,
$_SESSION
[
'_auth'
][
'staff'
][
'key'
]);
//TODO: Lookup the backed and request logout..
$_SESSION
[
'_auth'
][
'staff'
]
=
array
();
$_SESSION
[
'_auth'
][
'staff'
]
=
array
();
$ost
->
logDebug
(
'Staff logout'
,
$ost
->
logDebug
(
'Staff logout'
,
sprintf
(
"%s logged out [%s]"
,
sprintf
(
"%s logged out [%s]"
,
...
@@ -395,9 +410,6 @@ abstract class UserAuthenticationBackend extends AuthenticationBackend {
...
@@ -395,9 +410,6 @@ abstract class UserAuthenticationBackend extends AuthenticationBackend {
static
function
signOut
(
$user
)
{
static
function
signOut
(
$user
)
{
global
$ost
;
global
$ost
;
list
(
$id
,
$auth
)
=
explode
(
':'
,
$_SESSION
[
'_auth'
][
'user'
][
'key'
]);
//TODO: Lookup the backed and request logout..
$_SESSION
[
'_auth'
][
'user'
]
=
array
();
$_SESSION
[
'_auth'
][
'user'
]
=
array
();
$ost
->
logDebug
(
'User logout'
,
$ost
->
logDebug
(
'User logout'
,
sprintf
(
"%s logged out [%s]"
,
sprintf
(
"%s logged out [%s]"
,
...
...
This diff is collapsed.
Click to expand it.
include/class.client.php
+
3
−
2
View file @
680d96d0
...
@@ -179,8 +179,9 @@ class EndUser extends AuthenticatedUser {
...
@@ -179,8 +179,9 @@ class EndUser extends AuthenticatedUser {
return
$this
->
isOwner
()
?
'owner'
:
'collaborator'
;
return
$this
->
isOwner
()
?
'owner'
:
'collaborator'
;
}
}
function
logOut
()
{
function
getAuthBackend
()
{
return
UserAuthenticationBackend
::
signOut
(
$this
);
list
(
$authkey
,)
=
explode
(
':'
,
$this
->
getAuthKey
());
return
UserAuthenticationBackend
::
getBackend
(
$authkey
);
}
}
function
getTicketStats
()
{
function
getTicketStats
()
{
...
...
This diff is collapsed.
Click to expand it.
include/class.staff.php
+
3
−
2
View file @
680d96d0
...
@@ -105,8 +105,9 @@ class Staff extends AuthenticatedUser {
...
@@ -105,8 +105,9 @@ class Staff extends AuthenticatedUser {
return
'staff'
;
return
'staff'
;
}
}
function
logOut
()
{
function
getAuthBackend
()
{
return
StaffAuthenticationBackend
::
signOut
(
$this
);
list
(
$authkey
,
)
=
explode
(
':'
,
$this
->
getAuthKey
());
return
StaffAuthenticationBackend
::
getBackend
(
$authkey
);
}
}
/*compares user password*/
/*compares user password*/
...
...
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