Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
greg
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
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
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
it-bott-integrasjoner
greg
Commits
44eb330d
Verified
Commit
44eb330d
authored
3 years ago
by
Andreas Ellewsen
Browse files
Options
Downloads
Patches
Plain Diff
Log when wrong person uses invitation
parent
3c51ae60
No related branches found
No related tags found
1 merge request
!282
Handle wrong person following invitation link
Pipeline
#117173
passed
3 years ago
Stage: venv update
Stage: tests and linting
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
gregui/authentication/auth_backends.py
+16
-0
16 additions, 0 deletions
gregui/authentication/auth_backends.py
with
16 additions
and
0 deletions
gregui/authentication/auth_backends.py
+
16
−
0
View file @
44eb330d
...
@@ -622,6 +622,13 @@ class GregOIDCBackend(ValidatingOIDCBackend):
...
@@ -622,6 +622,13 @@ class GregOIDCBackend(ValidatingOIDCBackend):
not
inv_person
.
registration_completed_date
not
inv_person
.
registration_completed_date
and
not
name_diff_too_large
(
old_name
,
inv_name
,
4
)
and
not
name_diff_too_large
(
old_name
,
inv_name
,
4
)
):
):
logger
.
info
(
"
Invitation (%s) opened by existing person (%s).
"
"
Giving role to them and deleting invited person (%s)
"
,
invitation_link
.
invitation
.
id
,
old_person
.
id
,
inv_person
.
id
,
)
# The name is close and the invited person has not completed
# The name is close and the invited person has not completed
# registration. Give the role to the existing person, and
# registration. Give the role to the existing person, and
# delete the invited one.
# delete the invited one.
...
@@ -632,6 +639,15 @@ class GregOIDCBackend(ValidatingOIDCBackend):
...
@@ -632,6 +639,15 @@ class GregOIDCBackend(ValidatingOIDCBackend):
else
:
else
:
# The logged in user has gotten someone else's invitation, and
# The logged in user has gotten someone else's invitation, and
# the invitation should be disabled.
# the invitation should be disabled.
logger
.
warning
(
"
Illegal person accessed invitation (%s). Invitation belongs to
"
"
person id %s, but was access by person id %s. Expiring
"
"
InvitationLink %s.
"
,
invitation_link
.
invitation
.
id
,
inv_person
.
id
,
old_person
.
id
,
invitation_link
.
id
,
)
invitation_link
.
expire
=
timezone
.
now
()
invitation_link
.
expire
=
timezone
.
now
()
invitation_link
.
save
()
invitation_link
.
save
()
else
:
else
:
...
...
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