Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
beat.web
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
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
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
beat
beat.web
Commits
955b82f9
Commit
955b82f9
authored
4 years ago
by
Flavio TARSETTI
Browse files
Options
Downloads
Patches
Plain Diff
[accounts][api] fix url prefix usage in api
Part of
#558
parent
9526c024
No related branches found
Branches containing commit
No related tags found
Tags containing commit
2 merge requests
!389
Cleanup url prefix use in accounts api
,
!342
Django 3 migration
Pipeline
#43136
passed
4 years ago
Stage: build
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
beat/web/accounts/api.py
+1
-24
1 addition, 24 deletions
beat/web/accounts/api.py
with
1 addition
and
24 deletions
beat/web/accounts/api.py
+
1
−
24
View file @
955b82f9
...
...
@@ -26,7 +26,6 @@
###############################################################################
import
datetime
from
urllib.parse
import
urlparse
from
django.conf
import
settings
from
django.contrib.auth.models
import
User
...
...
@@ -42,7 +41,6 @@ from ..ui.registration.models import RegistrationProfile
from
..utils
import
mail
from
.models
import
Profile
from
.models
import
SupervisionTrack
from
.models
import
TemporaryUrl
from
.permissions
import
IsAuthorAndNotSupervisor
from
.permissions
import
IsAuthorAndPossiblySupervisor
from
.permissions
import
IsSuperUser
...
...
@@ -204,20 +202,15 @@ class SupervisorRemoveSuperviseeView(BaseUpdateSupervisionTrackView):
}
return
BadRequestResponse
(
result
)
parsed_url
=
urlparse
(
settings
.
URL_PREFIX
)
server_address
=
"
%s://%s
"
%
(
parsed_url
.
scheme
,
parsed_url
.
hostname
)
if
not
supervisee
.
profile
.
is_supervisor
:
context
=
{
"
supervisor
"
:
supervisiontrack
.
supervisor
,
"
supervisee
"
:
supervisee
,
"
prefix
"
:
server_address
,
}
else
:
context
=
{
"
supervisor
"
:
request
.
user
,
"
supervisee
"
:
supervisee
,
"
prefix
"
:
server_address
,
}
if
supervisee
.
profile
.
status
==
Profile
.
WAITINGVALIDATION
:
...
...
@@ -315,7 +308,6 @@ class SupervisorRemoveSuperviseeView(BaseUpdateSupervisionTrackView):
context
=
{
"
supervisor
"
:
supervisee
,
"
supervisee
"
:
track_supervisee
,
"
prefix
"
:
server_address
,
}
mail
.
send_email
(
...
...
@@ -345,7 +337,6 @@ class SupervisorRemoveSuperviseeView(BaseUpdateSupervisionTrackView):
context
=
{
"
supervisor
"
:
track_supervisor
,
"
supervisee
"
:
track_supervisee
,
"
prefix
"
:
server_address
,
}
# New user account waiting validation, so delete this account and inform by email the user
...
...
@@ -422,9 +413,6 @@ class SuperviseeAddSupervisorView(BaseCreateSupervisionTrackViewSupervisee):
}
return
BadRequestResponse
(
result
)
parsed_url
=
urlparse
(
settings
.
URL_PREFIX
)
server_address
=
"
%s://%s
"
%
(
parsed_url
.
scheme
,
parsed_url
.
hostname
)
supervisee
=
request
.
user
if
supervisee
.
profile
.
supervision_key
is
not
None
:
# There's a key check if there's a valid track
...
...
@@ -452,7 +440,6 @@ class SuperviseeAddSupervisorView(BaseCreateSupervisionTrackViewSupervisee):
context
=
{
"
supervisor
"
:
supervisiontrack
.
supervisor
,
"
supervisee
"
:
supervisiontrack
.
supervisee
,
"
prefix
"
:
server_address
,
}
mail
.
send_email
(
...
...
@@ -519,7 +506,7 @@ class SuperviseeAddSupervisorView(BaseCreateSupervisionTrackViewSupervisee):
supervisee
.
save
()
# Inform by email the supervisor that he has a new supervisee request
_
=
inform_supervisor_new_supervisee_request
(
inform_supervisor_new_supervisee_request
(
request
,
supervisiontrack
,
supervisor
,
supervisee
)
...
...
@@ -661,9 +648,6 @@ class RemoveSupervisorModeView(BaseUpdateSupervisorModeView):
|
Q
(
supervisee__profile__status
=
Profile
.
WAITINGVALIDATION
)
)
parsed_url
=
urlparse
(
settings
.
URL_PREFIX
)
server_address
=
"
%s://%s
"
%
(
parsed_url
.
scheme
,
parsed_url
.
hostname
)
if
supervisiontracks
.
count
()
>
0
:
for
track
in
supervisiontracks
:
track
.
expiration_date
=
now
...
...
@@ -688,7 +672,6 @@ class RemoveSupervisorModeView(BaseUpdateSupervisorModeView):
context
=
{
"
supervisor
"
:
user
,
"
supervisee
"
:
track_supervisee
,
"
prefix
"
:
server_address
,
}
mail
.
send_email
(
...
...
@@ -718,7 +701,6 @@ class RemoveSupervisorModeView(BaseUpdateSupervisorModeView):
context
=
{
"
supervisor
"
:
track_supervisor
,
"
supervisee
"
:
track_supervisee
,
"
prefix
"
:
server_address
,
}
# New user account waiting validation, so delete this account and inform by email the user
...
...
@@ -883,14 +865,9 @@ class UpdateSupervisorCandidateView(BaseUpdateSupervisorCandidateView):
supervisee
.
is_active
=
True
supervisee
.
save
()
parsed_url
=
urlparse
(
settings
.
URL_PREFIX
)
server_address
=
"
%s://%s
"
%
(
parsed_url
.
scheme
,
parsed_url
.
hostname
)
# Inform by email the new supervisor
context
=
{
"
supervisor
"
:
request
.
user
,
"
supervisee
"
:
supervisee
,
"
prefix
"
:
server_address
,
}
mail
.
send_email
(
...
...
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