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

Commit 09fff12

Browse files
committed
Portal: Migrate from can to has_perm
1 parent 785653b commit 09fff12

File tree

2 files changed

+15
-18
lines changed

2 files changed

+15
-18
lines changed

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)