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
c64e62d0
Commit
c64e62d0
authored
Jun 01, 2016
by
Enrico Zini
Browse files
More vperms -> visit_perms
parent
d279198e
Changes
4
Hide whitespace changes
Inline
Side-by-side
backend/mixins.py
View file @
c64e62d0
...
@@ -70,12 +70,12 @@ class VisitorTemplateView(VisitorMixin, TemplateView):
...
@@ -70,12 +70,12 @@ class VisitorTemplateView(VisitorMixin, TemplateView):
class
VisitPersonMixin
(
VisitorMixin
):
class
VisitPersonMixin
(
VisitorMixin
):
"""
"""
Visit a person record. Adds self.person and self.vperms with the
Visit a person record. Adds self.person and self.v
isit_
perms with the
permissions the visitor has over the person
permissions the visitor has over the person
"""
"""
# Define to "edit_bio" "edit_ldap" or "view_person_audit_log" to raise
# Define to "edit_bio" "edit_ldap" or "view_person_audit_log" to raise
# PermissionDenied if the given test on the person-visitor fails
# PermissionDenied if the given test on the person-visitor fails
require_vperms
=
None
require_v
isit_
perms
=
None
def
get_person
(
self
):
def
get_person
(
self
):
key
=
self
.
kwargs
.
get
(
"key"
,
None
)
key
=
self
.
kwargs
.
get
(
"key"
,
None
)
...
@@ -94,7 +94,7 @@ class VisitPersonMixin(VisitorMixin):
...
@@ -94,7 +94,7 @@ class VisitPersonMixin(VisitorMixin):
def
check_permissions
(
self
):
def
check_permissions
(
self
):
super
(
VisitPersonMixin
,
self
).
check_permissions
()
super
(
VisitPersonMixin
,
self
).
check_permissions
()
if
self
.
require_vperms
and
self
.
require_vperms
not
in
self
.
visit_perms
.
perms
:
if
self
.
require_v
isit_
perms
and
self
.
require_v
isit_
perms
not
in
self
.
visit_perms
.
perms
:
raise
PermissionDenied
raise
PermissionDenied
def
get_context_data
(
self
,
**
kw
):
def
get_context_data
(
self
,
**
kw
):
...
@@ -111,7 +111,7 @@ class VisitPersonTemplateView(VisitPersonMixin, TemplateView):
...
@@ -111,7 +111,7 @@ class VisitPersonTemplateView(VisitPersonMixin, TemplateView):
class
VisitProcessMixin
(
VisitPersonMixin
):
class
VisitProcessMixin
(
VisitPersonMixin
):
"""
"""
Visit a person process. Adds self.person, self.process and self.vperms with
Visit a person process. Adds self.person, self.process and self.v
isit_
perms with
the permissions the visitor has over the person
the permissions the visitor has over the person
"""
"""
def
get_person
(
self
):
def
get_person
(
self
):
...
...
fprs/views.py
View file @
c64e62d0
...
@@ -23,7 +23,7 @@ class NewFingerprintForm(forms.ModelForm):
...
@@ -23,7 +23,7 @@ class NewFingerprintForm(forms.ModelForm):
class
PersonFingerprints
(
VisitPersonMixin
,
FormView
):
class
PersonFingerprints
(
VisitPersonMixin
,
FormView
):
template_name
=
"fprs/list.html"
template_name
=
"fprs/list.html"
require_vperms
=
"edit_ldap"
require_v
isit_
perms
=
"edit_ldap"
form_class
=
NewFingerprintForm
form_class
=
NewFingerprintForm
@
transaction
.
atomic
@
transaction
.
atomic
...
@@ -52,7 +52,7 @@ class FingerprintMixin(VisitPersonMixin):
...
@@ -52,7 +52,7 @@ class FingerprintMixin(VisitPersonMixin):
class
SetActiveFingerprint
(
FingerprintMixin
,
View
):
class
SetActiveFingerprint
(
FingerprintMixin
,
View
):
require_vperms
=
"edit_ldap"
require_v
isit_
perms
=
"edit_ldap"
@
transaction
.
atomic
@
transaction
.
atomic
def
post
(
self
,
request
,
*
args
,
**
kw
):
def
post
(
self
,
request
,
*
args
,
**
kw
):
...
...
process/views.py
View file @
c64e62d0
...
@@ -39,7 +39,7 @@ class Create(VisitPersonMixin, FormView):
...
@@ -39,7 +39,7 @@ class Create(VisitPersonMixin, FormView):
"""
"""
Create a new process
Create a new process
"""
"""
require_vperms
=
"request_new_status"
require_v
isit_
perms
=
"request_new_status"
template_name
=
"process/create.html"
template_name
=
"process/create.html"
def
get_context_data
(
self
,
**
kw
):
def
get_context_data
(
self
,
**
kw
):
...
@@ -246,7 +246,7 @@ class UnassignAM(RequirementMixin, View):
...
@@ -246,7 +246,7 @@ class UnassignAM(RequirementMixin, View):
class
StatementMixin
(
RequirementMixin
):
class
StatementMixin
(
RequirementMixin
):
require_vperms
=
"see_statements"
require_v
isit_
perms
=
"see_statements"
def
load_objects
(
self
):
def
load_objects
(
self
):
super
(
StatementMixin
,
self
).
load_objects
()
super
(
StatementMixin
,
self
).
load_objects
()
...
@@ -273,7 +273,7 @@ class StatementMixin(RequirementMixin):
...
@@ -273,7 +273,7 @@ class StatementMixin(RequirementMixin):
class
StatementCreate
(
StatementMixin
,
FormView
):
class
StatementCreate
(
StatementMixin
,
FormView
):
form_class
=
StatementForm
form_class
=
StatementForm
require_vperms
=
"edit_statements"
require_v
isit_
perms
=
"edit_statements"
template_name
=
"process/statement_edit.html"
template_name
=
"process/statement_edit.html"
def
load_objects
(
self
):
def
load_objects
(
self
):
...
@@ -340,7 +340,7 @@ class StatementCreate(StatementMixin, FormView):
...
@@ -340,7 +340,7 @@ class StatementCreate(StatementMixin, FormView):
class
StatementDelete
(
StatementMixin
,
TemplateView
):
class
StatementDelete
(
StatementMixin
,
TemplateView
):
require_vperms
=
"edit_statements"
require_v
isit_
perms
=
"edit_statements"
template_name
=
"process/statement_delete.html"
template_name
=
"process/statement_delete.html"
def
post
(
self
,
request
,
*
args
,
**
kw
):
def
post
(
self
,
request
,
*
args
,
**
kw
):
...
@@ -354,7 +354,7 @@ class StatementRaw(StatementMixin, View):
...
@@ -354,7 +354,7 @@ class StatementRaw(StatementMixin, View):
class
MailArchive
(
VisitProcessMixin
,
View
):
class
MailArchive
(
VisitProcessMixin
,
View
):
require_vperms
=
"view_mbox"
require_v
isit_
perms
=
"view_mbox"
def
get
(
self
,
request
,
key
,
*
args
,
**
kw
):
def
get
(
self
,
request
,
key
,
*
args
,
**
kw
):
fname
=
self
.
process
.
mailbox_file
fname
=
self
.
process
.
mailbox_file
...
@@ -380,7 +380,7 @@ class MailArchive(VisitProcessMixin, View):
...
@@ -380,7 +380,7 @@ class MailArchive(VisitProcessMixin, View):
class
DisplayMailArchive
(
VisitProcessMixin
,
TemplateView
):
class
DisplayMailArchive
(
VisitProcessMixin
,
TemplateView
):
require_vperms
=
"view_mbox"
require_v
isit_
perms
=
"view_mbox"
template_name
=
"restricted/display-mail-archive.html"
template_name
=
"restricted/display-mail-archive.html"
def
get_context_data
(
self
,
**
kw
):
def
get_context_data
(
self
,
**
kw
):
...
@@ -510,10 +510,10 @@ class DisplayMailArchive(VisitProcessMixin, TemplateView):
...
@@ -510,10 +510,10 @@ class DisplayMailArchive(VisitProcessMixin, TemplateView):
#
#
#class Show(StatementMixin, VisitStatementMixin, TemplateView):
#class Show(StatementMixin, VisitStatementMixin, TemplateView):
# template_name = "statements/show.html"
# template_name = "statements/show.html"
# require_vperms = "see_statements"
# require_v
isit_
perms = "see_statements"
#
#
#
#
#class Edit(EditStatementMixin, VisitStatementMixin, FormView):
#class Edit(EditStatementMixin, VisitStatementMixin, FormView):
# template_name = "statements/edit.html"
# template_name = "statements/edit.html"
# form_class = StatementForm
# form_class = StatementForm
# require_vperms = "edit_statements"
# require_v
isit_
perms = "edit_statements"
public/views.py
View file @
c64e62d0
...
@@ -419,7 +419,7 @@ class Process(VisitProcessTemplateView):
...
@@ -419,7 +419,7 @@ class Process(VisitProcessTemplateView):
class
ProcessUpdateKeycheck
(
VisitProcessMixin
,
View
):
class
ProcessUpdateKeycheck
(
VisitProcessMixin
,
View
):
require_vperms
=
"update_keycheck"
require_v
isit_
perms
=
"update_keycheck"
def
post
(
self
,
request
,
key
,
*
args
,
**
kw
):
def
post
(
self
,
request
,
key
,
*
args
,
**
kw
):
from
keyring.models
import
Key
from
keyring.models
import
Key
...
...
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