Skip to content
This repository was archived by the owner on May 19, 2021. It is now read-only.

Commit 960cd2f

Browse files
authored
Merge pull request #187 from chris34/migrate-to-has_perm
Migrate to `has_perm()` for new ACL
2 parents 840c1fa + 09fff12 commit 960cd2f

File tree

7 files changed

+25
-28
lines changed

7 files changed

+25
-28
lines changed

inyoka_theme_default/templates/ikhaya/category_edit.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222

2323
{% block sidebar %}
2424
{% call macros.sidebar() %}
25-
{% if USER.can('static_file_edit') %}
25+
{% if USER.has_perm('portal.change_staticfile') %}
2626
{{ macros.sidebar_item(_('Upload new icon'), href('portal', 'files', 'new')) }}
2727
{% endif %}
2828
{% endcall %}

inyoka_theme_default/templates/ikhaya/index.html

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
{% call macros.sidebar_item() %}
5050
<a href="{{ category|url }}">{{ category.name|e }}</a>
5151

52-
{% if USER.can('category_edit') %}
52+
{% if USER.has_perm('ikhaya.change_category"') %}
5353
<a href="{{ href('ikhaya', 'category', category.slug, 'edit') }}"><span class="fa_icon-pencil"></span></a>
5454
{% endif %}
5555
{% endcall %}
@@ -61,13 +61,13 @@
6161
{{ macros.sidebar_item(_('Archive'), href('ikhaya', 'archive'), 'fa_icon-archive') }}
6262
{% endcall %}
6363

64-
{% if USER.can('article_edit') or USER.can('category_edit') %}
64+
{% if USER.has_perm('ikhaya.change_article') or USER.has_perm('ikhaya.change_category"') %}
6565
{% call macros.sidebar_admin() %}
66-
{% if USER.can('article_edit') %}
66+
{% if USER.has_perm('ikhaya.change_article') %}
6767
{{ macros.sidebar_item(_('New article'), href('ikhaya', 'article', 'new')) }}
6868
{% endif %}
6969

70-
{% if USER.can('category_edit') %}
70+
{% if USER.has_perm('ikhaya.change_category"') %}
7171
{{ macros.sidebar_item(_('Add category'), href('ikhaya', 'category', 'new')) }}
7272
{% endif %}
7373
{% endcall %}
@@ -131,7 +131,7 @@ <h3>
131131
{% endif %}
132132
</li>
133133

134-
{% if USER.can('article_edit') %}
134+
{% if USER.has_perm('ikhaya.change_article') %}
135135
<li>
136136
<a href="{{ article|url('edit') }}">
137137
{% trans %}Edit{% endtrans %}

inyoka_theme_default/templates/pastebin/display.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
{{ macros.sidebar_item(_('Display entry as raw text'), entry|url('raw')) }}
2727
{% endcall %}
2828

29-
{% if USER.can('manage_pastebin') %}
29+
{% if USER.has_perm('pastebin.change_entry') %}
3030
{% call macros.sidebar_admin() %}
3131
{{ macros.sidebar_item(_('Delete entry'), entry|url('delete')) }}
3232
{% endcall %}

inyoka_theme_default/templates/planet/base.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,15 +38,15 @@
3838
{% call macros.sidebar_item() %}
3939
<a href="{{ blog|url|e }}">{{ blog.name|e }}</a>
4040

41-
{% if USER.can('category_edit') %}
41+
{% if USER.has_perm('planet.change_blog') %}
4242
<a href="{{ blog|url('edit') }}"> <span class="fa_icon-pencil"></span></a>
4343
{% endif %}
4444
{% endcall %}
4545
{% endfor %}
4646
{% endcall %}
4747
{% endif %}
4848

49-
{% if USER.can('blog_edit') %}
49+
{% if USER.has_perm('planet.change_blog') %}
5050
{% call macros.sidebar_admin() %}
5151
{{ macros.sidebar_item(_('new blog'), href('planet', 'blog', 'new')) }}
5252
{{ macros.sidebar_item(_('Bloglist'), href('planet', 'blogs')) }}

inyoka_theme_default/templates/planet/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ <h3>
8787
{% trans %}Permanent link{% endtrans %}
8888
</a>
8989
</li>
90-
{% if USER.can('blog_edit') %}
90+
{% if USER.has_perm('planet.change_blog') %}
9191
{% if article.hidden and article.hidden_by %}
9292
<li>
9393
{% trans user_link=macros.render_user_link(article.hidden_by) %}

inyoka_theme_default/templates/portal/base.html

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
{% extends 'base.html' %}
1212

1313
{% block title %}
14-
{{ _('Portal') }} - {{ super() }}
14+
{{ _('Portal') }} {{ super() }}
1515
{% endblock %}
1616

1717
{% set active_app = 'portal' %}
@@ -32,23 +32,20 @@
3232
{{ macros.sidebar_item(_('Calendar'), href('portal', 'calendar')) }}
3333
{% endcall %}
3434

35-
{% if USER.can('static_page_edit')
36-
or USER.can('static_file_edit')
37-
or USER.can('configuration_edit')
38-
or USER.can('markup_css_edit')
35+
{% if USER.has_perm('portal.change_staticpage')
36+
or USER.has_perm('portal.change_staticfile')
37+
or USER.has_perm('portal.change_storage')
3938
%}
4039
{% call macros.sidebar_admin() %}
41-
{% if USER.can('configuration_edit') %}
42-
{{ macros.sidebar_item(_('General'),href('portal', 'config')) }}
40+
{% if USER.has_perm('portal.change_storage') %}
41+
{{ macros.sidebar_item(_('General'), href('portal', 'config')) }}
4342
{% endif %}
44-
{% if USER.can('markup_css_edit') %}
45-
{{ macros.sidebar_item(_('Stylesheets'),href('portal', 'styles')) }}
43+
{% if USER.has_perm('portal.change_staticpage') %}
44+
{{ macros.sidebar_item(_('Stylesheets'), href('portal', 'styles')) }}
45+
{{ macros.sidebar_item(_('Static pages'), href('portal', 'pages')) }}
4646
{% endif %}
47-
{% if USER.can('static_page_edit') %}
48-
{{ macros.sidebar_item(_('Static pages'),href('portal', 'pages')) }}
49-
{% endif %}
50-
{% if USER.can('static_file_edit') %}
51-
{{ macros.sidebar_item(_('Static files'),href('portal', 'files')) }}
47+
{% if USER.has_perm('portal.change_staticfile') %}
48+
{{ macros.sidebar_item(_('Static files'), href('portal', 'files')) }}
5249
{% endif %}
5350
{% endcall %}
5451
{% endif %}

inyoka_theme_default/templates/portal/profile.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
{% macro show_item(item) %}
2424
{% if user[item] and user.settings['show_'+item] %}
2525
<td>{{ user[item]|e }}</td>
26-
{% elif user[item] and REQUEST.user.can('user_edit') %}
26+
{% elif user[item] and REQUEST.user.has_perm('portal.change_user') %}
2727
<td class="hidden-info">{{ user[item]|e }}</td>
2828
{% else %}
2929
<td>–</td>
@@ -33,7 +33,7 @@
3333
{% block sidebar %}
3434

3535
{% call macros.sidebar() %}
36-
{% if request.user.can('subscribe_to_users') %}
36+
{% if request.user.has_perm('portal.subscribe_user') %}
3737
{% call macros.sidebar_item() %}
3838
{% if is_subscribed %}
3939
{{ macros.outer_form(csrf_token(), action=href('portal', 'user', user.username, 'unsubscribe')|e , submit_label=_('Don’t watch anymore')) }}
@@ -47,7 +47,7 @@
4747
{{ macros.sidebar_item(_('show posts'), href('forum', 'author', user.username)) }}
4848
{% endcall %}
4949

50-
{% if request.user.can('user_edit') %}
50+
{% if request.user.has_perm('portal.change_user') %}
5151
{% call macros.sidebar_admin() %}
5252
{{ macros.sidebar_item(_('Edit user'), href('portal', 'user', user.username, 'edit', 'profile')) }}
5353
{{ macros.sidebar_item(_('Edit groups'), href('portal', 'user', user.username, 'edit', 'groups')) }}
@@ -85,7 +85,7 @@ <h3>
8585
<th>{% trans %}Jabber{% endtrans %}</th>
8686
{% if user.jabber and user.settings['show_jabber'] %}
8787
<td><a href="{{ user.jabber_url|e }}">{{ user.jabber|e }}</a></td>
88-
{% elif user.jabber and REQUEST.user.can('user_edit') %}
88+
{% elif user.jabber and REQUEST.user.has_perm('portal.change_user') %}
8989
<td class="hidden-info">
9090
<a href="{{ user.jabber_url|e }}">{{ user.jabber|e }}</a>
9191
</td>

0 commit comments

Comments
 (0)