Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
C
common-web
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Iterations
Merge Requests
0
Merge Requests
0
Requirements
Requirements
List
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Test Cases
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issue
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
protokollsystem
common-web
Commits
e9e79e08
Commit
e9e79e08
authored
Apr 10, 2018
by
Robin Sonnabend
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add version field to auth cookie
parent
2a0f8817
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
9 deletions
+17
-9
auth.py
auth.py
+17
-9
No files found.
auth.py
View file @
e9e79e08
...
...
@@ -3,6 +3,7 @@ import hashlib
import
ssl
from
datetime
import
datetime
FORMAT_VERSION
=
1
class
User
:
def
__init__
(
self
,
username
,
groups
,
all_groups
,
timestamp
=
None
,
...
...
@@ -22,19 +23,26 @@ class User:
def
summarize
(
self
):
return
":"
.
join
((
self
.
username
,
","
.
join
(
self
.
groups
),
","
.
join
(
self
.
all_groups
),
str
(
self
.
timestamp
.
timestamp
()),
str
(
self
.
permanent
)))
str
(
self
.
timestamp
.
timestamp
()),
str
(
self
.
permanent
),
str
(
FORMAT_VERSION
)))
@
staticmethod
def
from_summary
(
summary
):
parts
=
summary
.
split
(
":"
,
4
)
if
len
(
parts
)
!=
5
:
parts
=
summary
.
split
(
":"
,
5
)
if
len
(
parts
)
!=
6
:
return
None
(
name
,
group_str
,
all_group_str
,
timestamp_str
,
permanent_str
,
version_str
)
=
parts
try
:
if
int
(
version_str
)
!=
FORMAT_VERSION
:
return
None
timestamp
=
datetime
.
fromtimestamp
(
float
(
timestamp_str
))
groups
=
group_str
.
split
(
","
)
all_groups
=
all_group_str
.
split
(
","
)
permanent
=
permanent_str
==
"True"
return
User
(
name
,
groups
,
all_groups
,
timestamp
,
permanent
)
except
ValueError
:
return
None
(
name
,
group_str
,
all_group_str
,
timestamp_str
,
permanent_str
)
=
parts
timestamp
=
datetime
.
fromtimestamp
(
float
(
timestamp_str
))
groups
=
group_str
.
split
(
","
)
all_groups
=
all_group_str
.
split
(
","
)
permanent
=
permanent_str
==
"True"
return
User
(
name
,
groups
,
all_groups
,
timestamp
,
permanent
)
@
staticmethod
def
from_hashstring
(
secure_string
):
...
...
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