Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
1c37d511
Commit
1c37d511
authored
Nov 26, 2020
by
Alex Pooley
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Document ActiveSession class
parent
80cf00a1
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
1 deletion
+24
-1
app/models/active_session.rb
app/models/active_session.rb
+24
-1
No files found.
app/models/active_session.rb
View file @
1c37d511
# frozen_string_literal: true
# Backing store for GitLab session data.
#
# The raw session information is stored by the Rails session store
# (config/initializers/session_store.rb). These entries are accessible by the
# rack_key_name class method and consistute the base of the session data
# entries. All other entries in the session store can be traced back to these
# entries.
#
# After a user logs in (config/initializers/warden.rb) a further entry is made
# in Redis. This entry holds a record of the user's logged in session. These
# are accessible with the key_name(user_id, session_id) class method. These
# entries will expire. Lookups to these entries are lazilly cleaned on future
# user access.
#
# There is a reference to all sessions that belong to a specific user. A
# user may login through multiple browsers/devices and thus record multiple
# login sessions. These are accessible through the lookup_key_name(user_id)
# class method.
#
class
ActiveSession
include
ActiveModel
::
Model
...
...
@@ -143,6 +162,10 @@ class ActiveSession
list
(
user
).
reject
(
&
:is_impersonated
)
end
def
self
.
rack_key_name
(
session_id
)
"
#{
Gitlab
::
Redis
::
SharedState
::
SESSION_NAMESPACE
}
:
#{
session_id
}
"
end
def
self
.
key_name
(
user_id
,
session_id
=
'*'
)
"
#{
Gitlab
::
Redis
::
SharedState
::
USER_SESSIONS_NAMESPACE
}
:
#{
user_id
}
:
#{
session_id
}
"
end
...
...
@@ -197,7 +220,7 @@ class ActiveSession
end
def
self
.
rack_session_keys
(
rack_session_ids
)
rack_session_ids
.
map
{
|
session_id
|
"
#{
Gitlab
::
Redis
::
SharedState
::
SESSION_NAMESPACE
}
:
#{
session_id
}
"
}
rack_session_ids
.
map
{
|
session_id
|
rack_key_name
(
session_id
)
}
end
def
self
.
raw_active_session_entries
(
redis
,
session_ids
,
user_id
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment