Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
panikdb
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
radiopanik
panikdb
Commits
637ea45b
Commit
637ea45b
authored
May 26, 2015
by
fred
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
finer grained handling of permissions
parent
2128c5b1
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
6 additions
and
6 deletions
+6
-6
panikdb/aa/models.py
panikdb/aa/models.py
+4
-4
panikdb/templates/home.html
panikdb/templates/home.html
+1
-1
panikdb/urls_utils.py
panikdb/urls_utils.py
+1
-1
No files found.
panikdb/aa/models.py
View file @
637ea45b
...
...
@@ -14,11 +14,11 @@ class User(AbstractUser):
if
self
.
is_staff
:
return
True
if
isinstance
(
object
,
Emission
):
return
object
in
self
.
emissions
.
all
()
return
self
.
has_perm
(
'emissions.change_emission'
)
or
object
in
self
.
emissions
.
all
()
if
isinstance
(
object
,
Episode
):
return
object
.
emission
in
self
.
emissions
.
all
()
return
self
.
has_perm
(
'emissions.change_episode'
)
or
object
.
emission
in
self
.
emissions
.
all
()
if
isinstance
(
object
,
SoundFile
):
return
object
.
episode
.
emission
in
self
.
emissions
.
all
()
return
self
.
has_perm
(
'emissions.change_soundfile'
)
or
object
.
episode
.
emission
in
self
.
emissions
.
all
()
if
isinstance
(
object
,
NewsItem
):
return
object
.
emission
in
self
.
emissions
.
all
()
return
self
.
has_perm
(
'emissions.change_newsitem'
)
or
object
.
emission
in
self
.
emissions
.
all
()
return
False
panikdb/templates/home.html
View file @
637ea45b
{% extends "base.html" %}
{% block appbar %}
{% if
user.is_staff
%}
{% if
perms.emissions.change_emission
%}
<span><a
href=
"{% url 'emission-list' %}"
>
Toutes les émissions
</a>
-
<a
href=
"{% url 'news-list' %}"
>
Toutes les actus
</a></span>
...
...
panikdb/urls_utils.py
View file @
637ea45b
...
...
@@ -34,7 +34,7 @@ def decorated_includes(func, includes, *args, **kwargs):
def
cms_permission_required
(
function
=
None
,
login_url
=
None
):
def
check_cms_permission
(
user
):
if
user
and
user
.
has_perm
(
'
combo
.add_page'
):
if
user
and
user
.
has_perm
(
'
data
.add_page'
):
return
True
if
user
and
not
user
.
is_anonymous
():
raise
PermissionDenied
()
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a 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