***
Wartungsfenster jeden ersten Mittwoch vormittag im Monat
***
Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Invenio Theme TUW
Manage
Activity
Members
Labels
Plan
Issues
11
Issue boards
Milestones
Iterations
Wiki
Code
Merge requests
1
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Terraform modules
Analyze
Contributor 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
Show more breadcrumbs
Center for Research Data Management
Invenio Theme TUW
Commits
df8ab36d
Verified
Commit
df8ab36d
authored
1 year ago
by
Tsepelakis, Sotirios
🎯
Browse files
Options
Downloads
Patches
Plain Diff
Views: add status code in guards
parent
4c47c44f
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!80
Add test cases
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
invenio_theme_tuw/views.py
+11
-6
11 additions, 6 deletions
invenio_theme_tuw/views.py
with
11 additions
and
6 deletions
invenio_theme_tuw/views.py
+
11
−
6
View file @
df8ab36d
...
...
@@ -51,8 +51,9 @@ def fetch_schemaorg_jsonld(doi_url):
def
guarded_deposit_create
(
*
args
,
**
kwargs
):
"""
Guard the creation page for records, based on permissions.
"""
if
not
rec_service
.
check_permission
(
g
.
identity
,
"
create
"
):
return
render_template
(
"
invenio_theme_tuw/guards/deposit.html
"
,
user
=
current_user
return
(
render_template
(
"
invenio_theme_tuw/guards/deposit.html
"
,
user
=
current_user
),
403
,
)
return
deposit_create
(
*
args
,
**
kwargs
)
...
...
@@ -67,8 +68,9 @@ def guarded_deposit_edit(*args, **kwargs):
kwargs
[
"
pid_value
"
],
registered_only
=
False
)
if
not
rec_service
.
check_permission
(
g
.
identity
,
"
update_draft
"
,
record
=
draft
):
return
render_template
(
"
invenio_theme_tuw/guards/deposit.html
"
,
user
=
current_user
return
(
render_template
(
"
invenio_theme_tuw/guards/deposit.html
"
,
user
=
current_user
),
403
,
)
return
deposit_edit
(
*
args
,
**
kwargs
)
...
...
@@ -78,8 +80,11 @@ def guarded_deposit_edit(*args, **kwargs):
def
guarded_communities_create
(
*
args
,
**
kwargs
):
"""
Guard the communities creation page, based on permissions.
"""
if
not
current_communities
.
service
.
check_permission
(
g
.
identity
,
"
create
"
):
return
render_template
(
"
invenio_theme_tuw/guards/community.html
"
,
user
=
current_user
return
(
render_template
(
"
invenio_theme_tuw/guards/community.html
"
,
user
=
current_user
),
403
,
)
return
communities_new
(
*
args
,
**
kwargs
)
...
...
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