Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Debian New Member Process
nm.debian.org
Commits
eec998fa
Commit
eec998fa
authored
Apr 25, 2020
by
Enrico Zini
Browse files
Removed compatibility names, just use request.impersonator. refs:
#12
parent
09becb53
Changes
3
Hide whitespace changes
Inline
Side-by-side
backend/mixins.py
View file @
eec998fa
...
...
@@ -22,16 +22,13 @@ class OverrideView(Exception):
class
VisitorMixin
(
NM2LayoutMixin
):
"""
Add self.visitor and self.impersonator to the View for the person visiting
the site
Add self.visitor to the View for the person visiting the site
"""
# Define to "dd" "am" or "admin" to raise PermissionDenied if the
# given test on the visitor fails
require_visitor
=
None
def
set_visitor_info
(
self
):
self
.
impersonator
=
getattr
(
self
.
request
,
"impersonator"
,
None
)
if
not
self
.
request
.
user
.
is_authenticated
:
self
.
visitor
=
None
else
:
...
...
@@ -70,7 +67,6 @@ class VisitorMixin(NM2LayoutMixin):
def
get_context_data
(
self
,
**
kw
):
ctx
=
super
(
VisitorMixin
,
self
).
get_context_data
(
**
kw
)
ctx
[
"visitor"
]
=
self
.
visitor
ctx
[
"impersonator"
]
=
self
.
impersonator
return
ctx
...
...
nmlayout/templates/nm2-base.html
View file @
eec998fa
...
...
@@ -78,10 +78,10 @@ window.nm2.url_api_people = "{% url 'api_people' %}";
</a>
<div
class=
"dropdown-menu dropdown-menu-right"
role=
"menu"
aria-labelledby=
"navbarDropdown"
>
{% block visitor_menu %}
{% if impersonator %}
{% if
request.
impersonator %}
<form
class=
"form-inline"
method=
"POST"
action=
"{% url 'impersonate:impersonate' %}"
>
{% csrf_token %}
<input
type=
"hidden"
name=
"next"
value=
"{{request.build_absolute_uri}}"
>
<button
class=
"dropdown-item btn btn-link"
type=
"submit"
><span
class=
"fa fa-random"
></span>
(really {{impersonator.lookup_key}})
</button>
<button
class=
"dropdown-item btn btn-link"
type=
"submit"
><span
class=
"fa fa-random"
></span>
(really {{
request.
impersonator.lookup_key}})
</button>
</form>
{% endif %}
{% if user.is_anonymous %}
...
...
@@ -119,9 +119,9 @@ window.nm2.url_api_people = "{% url 'api_people' %}";
{% block page_lead %}
{{super}}
{% if impersonator %}
{% if
request.
impersonator %}
<div
id=
"impersonation"
class=
"container-fluid bg-warning"
>
<span
class=
"badge badge-pill badge-light"
><span
class=
"fa fa-random"
></span>
{{impersonator.a_link}} as {{visitor.a_link}}
</span>
<span
class=
"badge badge-pill badge-light"
><span
class=
"fa fa-random"
></span>
{{
request.
impersonator.a_link}} as {{visitor.a_link}}
</span>
<form
class=
"form-inline"
method=
"POST"
action=
"{% url 'impersonate:impersonate' %}"
>
{% csrf_token %}
<input
type=
"hidden"
name=
"next"
value=
"{{request.build_absolute_uri}}"
>
<button
class=
"badge badge-pill badge-primary"
type=
"submit"
>
{% trans "Cancel" %}
</button>
...
...
signon/templates/signon/login.html
View file @
eec998fa
...
...
@@ -6,7 +6,7 @@
<h1>
nm.debian.org login
</h1>
{% if not impersonator %}
{% if not
request.
impersonator %}
{% if not providers_active and not providers_inactive %}
<p
class=
"lead"
>
{% blocktrans %}
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment