diff --git a/resources/views/admin/log.twig b/resources/views/admin/log.twig index 87ea55cb..effff772 100644 --- a/resources/views/admin/log.twig +++ b/resources/views/admin/log.twig @@ -22,7 +22,7 @@ }) }} - {% if has_permission_to('logs.all') %} + {% if can('logs.all') %}
{{ f.select('search_user_id', __('general.user'), users, { 'default_option': __('form.user_select'), @@ -36,7 +36,7 @@
- {% if not has_permission_to('logs.all') %} + {% if not can('logs.all') %}
{{ m.alert(__('log.only_own')) }}
diff --git a/resources/views/admin/shifttypes/index.twig b/resources/views/admin/shifttypes/index.twig index 42ae512a..88fb84c7 100644 --- a/resources/views/admin/shifttypes/index.twig +++ b/resources/views/admin/shifttypes/index.twig @@ -13,9 +13,9 @@ {{ block('title') }} - {% if is_index|default(false) and has_permission_to('shifttypes.edit') %} + {% if is_index|default(false) and can('shifttypes.edit') %} {{ m.button(m.icon('plus-lg'), url('/admin/shifttypes/edit'), 'secondary') }} - {% elseif is_view|default(false) and has_permission_to('shifttypes.edit') %} + {% elseif is_view|default(false) and can('shifttypes.edit') %} {{ m.button(m.icon('pencil'), url('admin/shifttypes/edit/' ~ shifttype.id), null, 'sm', __('form.edit')) }} {% endif %} @@ -43,7 +43,7 @@ - {% if has_permission_to('shifttypes.edit') %} + {% if can('shifttypes.edit') %}
{{ m.button(m.icon('pencil'), url('admin/shifttypes/edit/' ~ shifttype.id), null, 'sm', __('form.edit')) }} diff --git a/resources/views/admin/user/edit-goodie.twig b/resources/views/admin/user/edit-goodie.twig index 0b99800b..f4187429 100644 --- a/resources/views/admin/user/edit-goodie.twig +++ b/resources/views/admin/user/edit-goodie.twig @@ -32,7 +32,7 @@
{{ f.switch('arrived', __('user.arrived'), { 'checked': userdata.state.arrived, - 'disabled': not has_permission_to('admin_arrive'), + 'disabled': not can('admin_arrive'), }) }} {% if userdata.state.force_active and config('enable_force_active') %} diff --git a/resources/views/layouts/app.twig b/resources/views/layouts/app.twig index abe1f041..025d1536 100644 --- a/resources/views/layouts/app.twig +++ b/resources/views/layouts/app.twig @@ -12,7 +12,7 @@ - {% if page() in ['news', 'meetings'] and is_user() and has_permission_to('atom') -%} + {% if page() in ['news', 'meetings'] and is_user() and can('atom') -%} {% set parameters = {'key': user.api_key} -%} {% if page() == 'meetings' -%} {% set parameters = {'meetings': 1}|merge(parameters) -%} diff --git a/resources/views/layouts/parts/footer.twig b/resources/views/layouts/parts/footer.twig index b9d7e9d1..dfc71527 100644 --- a/resources/views/layouts/parts/footer.twig +++ b/resources/views/layouts/parts/footer.twig @@ -39,7 +39,7 @@ {% for name,opt in config('footer_items') %} {% set url = opt is iterable ? opt[0] : opt %} {% set permission = opt is iterable ? opt[1] : null %} - {% if not permission or has_permission_to(permission) %} + {% if not permission or can(permission) %} {{ __(name) }} @@ -62,7 +62,7 @@ {% if is_guest() %} {% include "layouts/parts/language_dropdown.twig" %} - {% if has_permission_to('register') and config('registration_enabled') %} + {% if can('register') and config('registration_enabled') %} {{ _self.toolbar_item( __('general.register'), config('external_registration_url') ?: url('/register'), @@ -71,7 +71,7 @@ ) }} {% endif %} - {% if has_permission_to('login') %} + {% if can('login') %} {{ _self.toolbar_item(__('general.login'), url('/login'), 'login', 'box-arrow-in-right') }} {% endif %} {% endif %} @@ -79,7 +79,7 @@ {% if is_user() %} {{ _self.toolbar_item(menuUserShiftState(user), url('/shifts', {'action': 'next'}), '', 'clock', __('shift.next')) }} - {% if has_permission_to('user_messages') %} + {% if can('user_messages') %} {{ _self.toolbar_item( user_messages ? '' ~ user_messages ~ '' : '', url('/messages'), @@ -96,15 +96,15 @@ {{ m.angel() }} {{ user.displayName }} diff --git a/resources/views/pages/angeltypes/about.twig b/resources/views/pages/angeltypes/about.twig index 02979af8..e3d4bd9f 100644 --- a/resources/views/pages/angeltypes/about.twig +++ b/resources/views/pages/angeltypes/about.twig @@ -14,7 +14,7 @@ {{ __('angeltypes.angeltypes') }} {% else %} - {% if has_permission_to('register') and config('registration_enabled') %} + {% if can('register') and config('registration_enabled') %} {{ block('title') }} - {%- if has_permission_to('faq.edit') -%} + {%- if can('faq.edit') -%} {{ m.button(m.icon('plus-lg'), url('/admin/faq'), 'secondary') }} {%- endif %} @@ -18,7 +18,7 @@
{% block questions_text %} - {% if has_permission_to('question.add') %} + {% if can('question.add') %}

{{ __('faq.questions_link', [url('/questions')]) | raw }}

{% endif %} {% endblock %} @@ -52,7 +52,7 @@ {{ m.icon('clock') }} {{ item.updated_at.format(__('general.datetime')) }}
- {% if has_permission_to('faq.edit') %} + {% if can('faq.edit') %} {{ m.button(m.icon('pencil'), url('/admin/faq/' ~ item.id), 'secondary', 'sm', __('form.edit')) }} @@ -76,7 +76,7 @@ {% endblock %} {% block ask_question %} - {% if has_permission_to('question.add') %} + {% if can('question.add') %}
{{ csrf() }}
diff --git a/resources/views/pages/login.twig b/resources/views/pages/login.twig index 33de9f4c..6b46c655 100644 --- a/resources/views/pages/login.twig +++ b/resources/views/pages/login.twig @@ -105,7 +105,7 @@

{{ __('general.register') }}

{% if - (has_permission_to('register') and config('registration_enabled') and config('enable_password')) + (can('register') and config('registration_enabled') and config('enable_password')) or config('external_registration_url') %}

{{ __('login.registration') }}

diff --git a/resources/views/pages/news/edit.twig b/resources/views/pages/news/edit.twig index b57bb490..9ddc4bf6 100644 --- a/resources/views/pages/news/edit.twig +++ b/resources/views/pages/news/edit.twig @@ -52,7 +52,7 @@ {{ f.checkbox('is_pinned', __('news.edit.is_pinned'), { 'checked': is_pinned, }) }} - {% if has_permission_to('news.highlight') %} + {% if can('news.highlight') %} {{ f.checkbox('is_highlighted', __('news.edit.is_highlighted'), { 'checked': is_highlighted, }) }} diff --git a/resources/views/pages/news/news.twig b/resources/views/pages/news/news.twig index f8cef9ae..0215b578 100644 --- a/resources/views/pages/news/news.twig +++ b/resources/views/pages/news/news.twig @@ -24,7 +24,7 @@
{{ m.user(comment.user, {'pronoun': true}) }} - {% if comment.user.id == user.id or has_permission_to('admin_news') or has_permission_to('comment.delete') %} + {% if comment.user.id == user.id or can('admin_news') or can('comment.delete') %}

{{ __('news.comments.new') }}

diff --git a/resources/views/pages/news/overview.twig b/resources/views/pages/news/overview.twig index e22305cc..3b7a85c1 100644 --- a/resources/views/pages/news/overview.twig +++ b/resources/views/pages/news/overview.twig @@ -12,7 +12,7 @@ {{ m.button(m.icon('chevron-left'), url('/news'), null, 'sm', __('general.back')) }} {% endif %} {{ block('title') }} - {%- if has_permission_to('admin_news') and is_overview|default(false) -%} + {%- if can('admin_news') and is_overview|default(false) -%} {{ m.button(m.icon('plus-lg'), url('/admin/news', only_meetings ? {'meeting': 1} : {}), 'secondary') }} {%- endif %} @@ -97,7 +97,7 @@
{% endif %} - {% if has_permission_to('admin_news') %} + {% if can('admin_news') %}
- {% if has_permission_to('question.edit') %} + {% if can('question.edit') %} {{ m.user(question.user, {'pronoun': true}) }} {% endif %}
- {% if has_permission_to('question.edit') %} + {% if can('question.edit') %} {{ m.button(m.icon('pencil'), url('/admin/questions/' ~ question.id), null, 'sm', __('form.edit')) }} {% endif %} - {% if question.user.id == user.id or has_permission_to('question.edit') %} + {% if question.user.id == user.id or can('question.edit') %} {{ csrf() }} {{ f.hidden('id', question.id) }} diff --git a/resources/views/pages/registration.twig b/resources/views/pages/registration.twig index f7045aca..58b9bb9f 100644 --- a/resources/views/pages/registration.twig +++ b/resources/views/pages/registration.twig @@ -8,7 +8,7 @@

- {{ has_permission_to('admin_user') + {{ can('admin_user') ? m.button(m.icon('chevron-left'), url('/users'), null, 'sm', __('general.back')) : '' }} diff --git a/resources/views/pages/settings/api.twig b/resources/views/pages/settings/api.twig index 70e24893..a69f559b 100644 --- a/resources/views/pages/settings/api.twig +++ b/resources/views/pages/settings/api.twig @@ -16,7 +16,7 @@ }} ) }} - {% if has_permission_to('shifts_json_export') %} + {% if can('shifts_json_export') %} {{ f.button( __('settings.api.shifts_json_show'), {'size': 'sm', 'icon_left': 'braces', 'attr': { @@ -26,7 +26,7 @@ ) }} {% endif %} - {% if has_permission_to('ical') %} + {% if can('ical') %} {{ f.button( __('settings.api.ical_show'), {'size': 'sm', 'icon_left': 'calendar-week', 'attr': { @@ -36,7 +36,7 @@ ) }} {% endif %} - {% if has_permission_to('atom') %} + {% if can('atom') %} {{ f.button( __('settings.api.news_show'), {'size': 'sm', 'icon_left': 'calendar-week', 'attr': { @@ -65,26 +65,26 @@ {{ user.api_key }}

- {% if has_permission_to('shifts_json_export') %} + {% if can('shifts_json_export') %}

{{ url('/shifts-json-export', {'key': user.api_key}) }}

{% endif %} - {% if has_permission_to('ical') %} + {% if can('ical') %}

{{ url('/ical', {'key': user.api_key}) }}

{% endif %} - {% if has_permission_to('atom') %} + {% if can('atom') %}

{{ url('/atom', {'key': user.api_key}) }} - {% if has_permission_to('user_meetings') %} + {% if can('user_meetings') %}
{{ url('/atom', {'meetings': 1, 'key': user.api_key}) }} {% endif %}
{{ url('/rss', {'key': user.api_key}) }} - {% if has_permission_to('user_meetings') %} + {% if can('user_meetings') %}
{{ url('/rss', {'meetings': 1, 'key': user.api_key}) }} {% endif %}

@@ -95,7 +95,7 @@
- {% if has_permission_to('api') %} + {% if can('api') %} {{ __('settings.api.about', [ config('app_name'), url('/api/v0-beta'), diff --git a/resources/views/pages/settings/settings.twig b/resources/views/pages/settings/settings.twig index bf54bbb5..2a4afd95 100644 --- a/resources/views/pages/settings/settings.twig +++ b/resources/views/pages/settings/settings.twig @@ -21,7 +21,7 @@