Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
H
hypha
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
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
ots
hypha
Commits
99b8777b
Commit
99b8777b
authored
6 years ago
by
Erin Mullaney
Browse files
Options
Downloads
Patches
Plain Diff
#805 admin only permissions on Screening Status taxonomy
parent
00693274
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
opentech/public/utils/wagtail_hooks.py
+18
-0
18 additions, 0 deletions
opentech/public/utils/wagtail_hooks.py
with
18 additions
and
0 deletions
opentech/public/utils/wagtail_hooks.py
+
18
−
0
View file @
99b8777b
from
wagtail.contrib.modeladmin.helpers
import
PermissionHelper
from
wagtail.contrib.modeladmin.options
import
ModelAdminGroup
,
ModelAdmin
,
modeladmin_register
from
opentech.apply.funds.models
import
ScreeningStatus
...
...
@@ -15,9 +16,26 @@ class PersonTypeModelAdmin(ModelAdmin):
menu_icon
=
'
tag
'
class
ScreeningStatusPermissionHelper
(
PermissionHelper
):
def
user_can_edit_obj
(
self
,
user
,
obj
):
"""
Return a boolean to indicate whether `user` is permitted to
'
change
'
a specific `self.model` instance.
"""
return
user
.
is_superuser
def
user_can_delete_obj
(
self
,
user
,
obj
):
"""
Return a boolean to indicate whether `user` is permitted to
'
delete
'
a specific `self.model` instance.
"""
return
user
.
is_superuser
class
ScreeningStatusModelAdmin
(
ModelAdmin
):
model
=
ScreeningStatus
menu_icon
=
'
tag
'
permission_helper_class
=
ScreeningStatusPermissionHelper
class
TaxonomiesModelAdminGroup
(
ModelAdminGroup
):
...
...
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