rename has_permission_to(_any) to can(Any)
This commit is contained in:
parent
e514685444
commit
3972998ba0
|
@ -22,7 +22,7 @@
|
||||||
}) }}
|
}) }}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{% if has_permission_to('logs.all') %}
|
{% if can('logs.all') %}
|
||||||
<div class="col-md-4">
|
<div class="col-md-4">
|
||||||
{{ f.select('search_user_id', __('general.user'), users, {
|
{{ f.select('search_user_id', __('general.user'), users, {
|
||||||
'default_option': __('form.user_select'),
|
'default_option': __('form.user_select'),
|
||||||
|
@ -36,7 +36,7 @@
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{% if not has_permission_to('logs.all') %}
|
{% if not can('logs.all') %}
|
||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
{{ m.alert(__('log.only_own')) }}
|
{{ m.alert(__('log.only_own')) }}
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -13,9 +13,9 @@
|
||||||
|
|
||||||
{{ block('title') }}
|
{{ 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') }}
|
{{ 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')) }}
|
{{ m.button(m.icon('pencil'), url('admin/shifttypes/edit/' ~ shifttype.id), null, 'sm', __('form.edit')) }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</h1>
|
</h1>
|
||||||
|
@ -43,7 +43,7 @@
|
||||||
</td>
|
</td>
|
||||||
|
|
||||||
<td>
|
<td>
|
||||||
{% if has_permission_to('shifttypes.edit') %}
|
{% if can('shifttypes.edit') %}
|
||||||
<div class="d-flex ms-auto">
|
<div class="d-flex ms-auto">
|
||||||
{{ m.button(m.icon('pencil'), url('admin/shifttypes/edit/' ~ shifttype.id), null, 'sm', __('form.edit')) }}
|
{{ m.button(m.icon('pencil'), url('admin/shifttypes/edit/' ~ shifttype.id), null, 'sm', __('form.edit')) }}
|
||||||
|
|
||||||
|
|
|
@ -32,7 +32,7 @@
|
||||||
<div class="col-md-6">
|
<div class="col-md-6">
|
||||||
{{ f.switch('arrived', __('user.arrived'), {
|
{{ f.switch('arrived', __('user.arrived'), {
|
||||||
'checked': userdata.state.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') %}
|
{% if userdata.state.force_active and config('enable_force_active') %}
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
<link rel="stylesheet" type="text/css" href="{{ asset('assets/theme' ~ themeId ~ '.css') }}"/>
|
<link rel="stylesheet" type="text/css" href="{{ asset('assets/theme' ~ themeId ~ '.css') }}"/>
|
||||||
<script src="{{ asset('assets/vendor.js') }}"></script>
|
<script src="{{ asset('assets/vendor.js') }}"></script>
|
||||||
|
|
||||||
{% 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} -%}
|
{% set parameters = {'key': user.api_key} -%}
|
||||||
{% if page() == 'meetings' -%}
|
{% if page() == 'meetings' -%}
|
||||||
{% set parameters = {'meetings': 1}|merge(parameters) -%}
|
{% set parameters = {'meetings': 1}|merge(parameters) -%}
|
||||||
|
|
|
@ -39,7 +39,7 @@
|
||||||
{% for name,opt in config('footer_items') %}
|
{% for name,opt in config('footer_items') %}
|
||||||
{% set url = opt is iterable ? opt[0] : opt %}
|
{% set url = opt is iterable ? opt[0] : opt %}
|
||||||
{% set permission = opt is iterable ? opt[1] : null %}
|
{% set permission = opt is iterable ? opt[1] : null %}
|
||||||
{% if not permission or has_permission_to(permission) %}
|
{% if not permission or can(permission) %}
|
||||||
<a href="
|
<a href="
|
||||||
{%- if url starts with '/' %}
|
{%- if url starts with '/' %}
|
||||||
{{ url(url) }}
|
{{ url(url) }}
|
||||||
|
|
|
@ -48,7 +48,7 @@
|
||||||
{% for name,opt in config('header_items', {}) %}
|
{% for name,opt in config('header_items', {}) %}
|
||||||
{% set url = opt is iterable ? opt[0] : opt %}
|
{% set url = opt is iterable ? opt[0] : opt %}
|
||||||
{% set permission = opt is iterable ? opt[1] : null %}
|
{% set permission = opt is iterable ? opt[1] : null %}
|
||||||
{% if not permission or has_permission_to(permission) %}
|
{% if not permission or can(permission) %}
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<a class="nav-link" href="{{ url|replace({'%lang%': session_get('locale')|split('_')[0]})|escape('html_attr') }}">
|
<a class="nav-link" href="{{ url|replace({'%lang%': session_get('locale')|split('_')[0]})|escape('html_attr') }}">
|
||||||
{{ __(name) }}
|
{{ __(name) }}
|
||||||
|
@ -62,7 +62,7 @@
|
||||||
{% if is_guest() %}
|
{% if is_guest() %}
|
||||||
{% include "layouts/parts/language_dropdown.twig" %}
|
{% 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(
|
{{ _self.toolbar_item(
|
||||||
__('general.register'),
|
__('general.register'),
|
||||||
config('external_registration_url') ?: url('/register'),
|
config('external_registration_url') ?: url('/register'),
|
||||||
|
@ -71,7 +71,7 @@
|
||||||
) }}
|
) }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% if has_permission_to('login') %}
|
{% if can('login') %}
|
||||||
{{ _self.toolbar_item(__('general.login'), url('/login'), 'login', 'box-arrow-in-right') }}
|
{{ _self.toolbar_item(__('general.login'), url('/login'), 'login', 'box-arrow-in-right') }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
@ -79,7 +79,7 @@
|
||||||
{% if is_user() %}
|
{% if is_user() %}
|
||||||
{{ _self.toolbar_item(menuUserShiftState(user), url('/shifts', {'action': 'next'}), '', 'clock', __('shift.next')) }}
|
{{ _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(
|
{{ _self.toolbar_item(
|
||||||
user_messages ? '<span class="badge bg-danger">' ~ user_messages ~ '</span>' : '',
|
user_messages ? '<span class="badge bg-danger">' ~ user_messages ~ '</span>' : '',
|
||||||
url('/messages'),
|
url('/messages'),
|
||||||
|
@ -96,15 +96,15 @@
|
||||||
{{ m.angel() }} {{ user.displayName }}
|
{{ m.angel() }} {{ user.displayName }}
|
||||||
</a>
|
</a>
|
||||||
<ul class="dropdown-menu dropdown-menu-end">
|
<ul class="dropdown-menu dropdown-menu-end">
|
||||||
{% if has_permission_to('user_myshifts') %}
|
{% if can('user_myshifts') %}
|
||||||
{{ _self.dropdown_item(__('profile.my-shifts'), url('/users', {'action': 'view'}), 'users', m.icon('calendar-range')) }}
|
{{ _self.dropdown_item(__('profile.my-shifts'), url('/users', {'action': 'view'}), 'users', m.icon('calendar-range')) }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% if has_permission_to('user_settings') %}
|
{% if can('user_settings') %}
|
||||||
{{ _self.dropdown_item(__('settings.settings'), url('/settings/profile'), 'settings/profile', m.icon('person-fill-gear')) }}
|
{{ _self.dropdown_item(__('settings.settings'), url('/settings/profile'), 'settings/profile', m.icon('person-fill-gear')) }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% if has_permission_to('logout') %}
|
{% if can('logout') %}
|
||||||
{{ _self.dropdown_item(__('general.logout'), url('/logout'), 'logout', m.icon('box-arrow-left')) }}
|
{{ _self.dropdown_item(__('general.logout'), url('/logout'), 'logout', m.icon('box-arrow-left')) }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</ul>
|
</ul>
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
{{ __('angeltypes.angeltypes') }}
|
{{ __('angeltypes.angeltypes') }}
|
||||||
</a>
|
</a>
|
||||||
{% else %}
|
{% else %}
|
||||||
{% if has_permission_to('register') and config('registration_enabled') %}
|
{% if can('register') and config('registration_enabled') %}
|
||||||
<a
|
<a
|
||||||
href="{{ config('external_registration_url') ?: url('/register') }}"
|
href="{{ config('external_registration_url') ?: url('/register') }}"
|
||||||
class="btn btn-secondary back"
|
class="btn btn-secondary back"
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
<h1>
|
<h1>
|
||||||
{{ block('title') }}
|
{{ block('title') }}
|
||||||
|
|
||||||
{%- if has_permission_to('faq.edit') -%}
|
{%- if can('faq.edit') -%}
|
||||||
{{ m.button(m.icon('plus-lg'), url('/admin/faq'), 'secondary') }}
|
{{ m.button(m.icon('plus-lg'), url('/admin/faq'), 'secondary') }}
|
||||||
{%- endif %}
|
{%- endif %}
|
||||||
</h1>
|
</h1>
|
||||||
|
@ -18,7 +18,7 @@
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
{% block questions_text %}
|
{% block questions_text %}
|
||||||
{% if has_permission_to('question.add') %}
|
{% if can('question.add') %}
|
||||||
<p>{{ __('faq.questions_link', [url('/questions')]) | raw }}</p>
|
<p>{{ __('faq.questions_link', [url('/questions')]) | raw }}</p>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
@ -52,7 +52,7 @@
|
||||||
{{ m.icon('clock') }} {{ item.updated_at.format(__('general.datetime')) }}
|
{{ m.icon('clock') }} {{ item.updated_at.format(__('general.datetime')) }}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{% if has_permission_to('faq.edit') %}
|
{% if can('faq.edit') %}
|
||||||
<span class="ms-auto">
|
<span class="ms-auto">
|
||||||
{{ m.button(m.icon('pencil'), url('/admin/faq/' ~ item.id), 'secondary', 'sm', __('form.edit')) }}
|
{{ m.button(m.icon('pencil'), url('/admin/faq/' ~ item.id), 'secondary', 'sm', __('form.edit')) }}
|
||||||
</span>
|
</span>
|
||||||
|
@ -76,7 +76,7 @@
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block ask_question %}
|
{% block ask_question %}
|
||||||
{% if has_permission_to('question.add') %}
|
{% if can('question.add') %}
|
||||||
<form action="{{ url('/questions/new') }}" enctype="multipart/form-data" method="post">
|
<form action="{{ url('/questions/new') }}" enctype="multipart/form-data" method="post">
|
||||||
{{ csrf() }}
|
{{ csrf() }}
|
||||||
<div class="col-md-12">
|
<div class="col-md-12">
|
||||||
|
|
|
@ -105,7 +105,7 @@
|
||||||
<div class="col-sm-6 text-center">
|
<div class="col-sm-6 text-center">
|
||||||
<h2>{{ __('general.register') }}</h2>
|
<h2>{{ __('general.register') }}</h2>
|
||||||
{% if
|
{% 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') %}
|
or config('external_registration_url') %}
|
||||||
<p>{{ __('login.registration') }}</p>
|
<p>{{ __('login.registration') }}</p>
|
||||||
|
|
||||||
|
|
|
@ -52,7 +52,7 @@
|
||||||
{{ f.checkbox('is_pinned', __('news.edit.is_pinned'), {
|
{{ f.checkbox('is_pinned', __('news.edit.is_pinned'), {
|
||||||
'checked': is_pinned,
|
'checked': is_pinned,
|
||||||
}) }}
|
}) }}
|
||||||
{% if has_permission_to('news.highlight') %}
|
{% if can('news.highlight') %}
|
||||||
{{ f.checkbox('is_highlighted', __('news.edit.is_highlighted'), {
|
{{ f.checkbox('is_highlighted', __('news.edit.is_highlighted'), {
|
||||||
'checked': is_highlighted,
|
'checked': is_highlighted,
|
||||||
}) }}
|
}) }}
|
||||||
|
|
|
@ -24,7 +24,7 @@
|
||||||
</div>
|
</div>
|
||||||
{{ m.user(comment.user, {'pronoun': true}) }}
|
{{ 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') %}
|
||||||
<div class="ms-auto">
|
<div class="ms-auto">
|
||||||
<form
|
<form
|
||||||
action="{{ url('/news/comment/' ~ comment.id) }}" enctype="multipart/form-data"
|
action="{{ url('/news/comment/' ~ comment.id) }}" enctype="multipart/form-data"
|
||||||
|
@ -45,7 +45,7 @@
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block write_comment %}
|
{% block write_comment %}
|
||||||
{% if has_permission_to('news_comments') %}
|
{% if can('news_comments') %}
|
||||||
<div class="col-md-12 mt-4">
|
<div class="col-md-12 mt-4">
|
||||||
<h3>{{ __('news.comments.new') }}</h3>
|
<h3>{{ __('news.comments.new') }}</h3>
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
{{ m.button(m.icon('chevron-left'), url('/news'), null, 'sm', __('general.back')) }}
|
{{ m.button(m.icon('chevron-left'), url('/news'), null, 'sm', __('general.back')) }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{{ block('title') }}
|
{{ 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') }}
|
{{ m.button(m.icon('plus-lg'), url('/admin/news', only_meetings ? {'meeting': 1} : {}), 'secondary') }}
|
||||||
{%- endif %}
|
{%- endif %}
|
||||||
</h1>
|
</h1>
|
||||||
|
@ -97,7 +97,7 @@
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% if has_permission_to('admin_news') %}
|
{% if can('admin_news') %}
|
||||||
<div class="d-flex ms-auto">
|
<div class="d-flex ms-auto">
|
||||||
{{ m.button(m.icon('pencil'), url('/admin/news/' ~ news.id), 'secondary', 'sm', __('form.edit')) }}
|
{{ m.button(m.icon('pencil'), url('/admin/news/' ~ news.id), 'secondary', 'sm', __('form.edit')) }}
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
{% for name,opt in config('contact_options') %}
|
{% for name,opt in config('contact_options') %}
|
||||||
{% set url = opt is iterable ? opt[0] : opt %}
|
{% set url = opt is iterable ? opt[0] : opt %}
|
||||||
{% set permission = opt is iterable ? opt[1] : null %}
|
{% set permission = opt is iterable ? opt[1] : null %}
|
||||||
{% if not permission or has_permission_to(permission) %}
|
{% if not permission or can(permission) %}
|
||||||
<a href="
|
<a href="
|
||||||
{%- if url starts with '/' %}
|
{%- if url starts with '/' %}
|
||||||
{{ url(url) }}
|
{{ url(url) }}
|
||||||
|
@ -50,7 +50,7 @@
|
||||||
<div class="col-md-12">
|
<div class="col-md-12">
|
||||||
{% block questions %}
|
{% block questions %}
|
||||||
{% block faq_text %}
|
{% block faq_text %}
|
||||||
{% if has_permission_to('faq.view') %}
|
{% if can('faq.view') %}
|
||||||
{% if not is_admin | default(false) %}
|
{% if not is_admin | default(false) %}
|
||||||
<p>
|
<p>
|
||||||
{{ __('question.faq_link', [url('/faq')]) | raw }}
|
{{ __('question.faq_link', [url('/faq')]) | raw }}
|
||||||
|
@ -79,16 +79,16 @@
|
||||||
{{ m.icon('clock') }} {{ question.created_at.format(__('general.datetime')) }}
|
{{ m.icon('clock') }} {{ question.created_at.format(__('general.datetime')) }}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{% if has_permission_to('question.edit') %}
|
{% if can('question.edit') %}
|
||||||
{{ m.user(question.user, {'pronoun': true}) }}
|
{{ m.user(question.user, {'pronoun': true}) }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
<div class="d-flex ms-auto">
|
<div class="d-flex ms-auto">
|
||||||
{% if has_permission_to('question.edit') %}
|
{% if can('question.edit') %}
|
||||||
{{ m.button(m.icon('pencil'), url('/admin/questions/' ~ question.id), null, 'sm', __('form.edit')) }}
|
{{ m.button(m.icon('pencil'), url('/admin/questions/' ~ question.id), null, 'sm', __('form.edit')) }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% if question.user.id == user.id or has_permission_to('question.edit') %}
|
{% if question.user.id == user.id or can('question.edit') %}
|
||||||
<form class="ps-1" method="post" action="">
|
<form class="ps-1" method="post" action="">
|
||||||
{{ csrf() }}
|
{{ csrf() }}
|
||||||
{{ f.hidden('id', question.id) }}
|
{{ f.hidden('id', question.id) }}
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<div class="mb-5">
|
<div class="mb-5">
|
||||||
<h1>
|
<h1>
|
||||||
{{ has_permission_to('admin_user')
|
{{ can('admin_user')
|
||||||
? m.button(m.icon('chevron-left'), url('/users'), null, 'sm', __('general.back'))
|
? m.button(m.icon('chevron-left'), url('/users'), null, 'sm', __('general.back'))
|
||||||
: ''
|
: ''
|
||||||
}}
|
}}
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
}}
|
}}
|
||||||
) }}
|
) }}
|
||||||
|
|
||||||
{% if has_permission_to('shifts_json_export') %}
|
{% if can('shifts_json_export') %}
|
||||||
{{ f.button(
|
{{ f.button(
|
||||||
__('settings.api.shifts_json_show'),
|
__('settings.api.shifts_json_show'),
|
||||||
{'size': 'sm', 'icon_left': 'braces', 'attr': {
|
{'size': 'sm', 'icon_left': 'braces', 'attr': {
|
||||||
|
@ -26,7 +26,7 @@
|
||||||
) }}
|
) }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% if has_permission_to('ical') %}
|
{% if can('ical') %}
|
||||||
{{ f.button(
|
{{ f.button(
|
||||||
__('settings.api.ical_show'),
|
__('settings.api.ical_show'),
|
||||||
{'size': 'sm', 'icon_left': 'calendar-week', 'attr': {
|
{'size': 'sm', 'icon_left': 'calendar-week', 'attr': {
|
||||||
|
@ -36,7 +36,7 @@
|
||||||
) }}
|
) }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% if has_permission_to('atom') %}
|
{% if can('atom') %}
|
||||||
{{ f.button(
|
{{ f.button(
|
||||||
__('settings.api.news_show'),
|
__('settings.api.news_show'),
|
||||||
{'size': 'sm', 'icon_left': 'calendar-week', 'attr': {
|
{'size': 'sm', 'icon_left': 'calendar-week', 'attr': {
|
||||||
|
@ -65,26 +65,26 @@
|
||||||
<code>{{ user.api_key }}</code>
|
<code>{{ user.api_key }}</code>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
{% if has_permission_to('shifts_json_export') %}
|
{% if can('shifts_json_export') %}
|
||||||
<p id="shifts_json_hide" class="collapse" data-bs-parent="#exports_hide">
|
<p id="shifts_json_hide" class="collapse" data-bs-parent="#exports_hide">
|
||||||
<code>{{ url('/shifts-json-export', {'key': user.api_key}) }}</code>
|
<code>{{ url('/shifts-json-export', {'key': user.api_key}) }}</code>
|
||||||
</p>
|
</p>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% if has_permission_to('ical') %}
|
{% if can('ical') %}
|
||||||
<p id="ical_hide" class="collapse" data-bs-parent="#exports_hide">
|
<p id="ical_hide" class="collapse" data-bs-parent="#exports_hide">
|
||||||
<code>{{ url('/ical', {'key': user.api_key}) }}</code>
|
<code>{{ url('/ical', {'key': user.api_key}) }}</code>
|
||||||
</p>
|
</p>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% if has_permission_to('atom') %}
|
{% if can('atom') %}
|
||||||
<p id="news_hide" class="collapse" data-bs-parent="#exports_hide">
|
<p id="news_hide" class="collapse" data-bs-parent="#exports_hide">
|
||||||
<code>{{ url('/atom', {'key': user.api_key}) }}</code>
|
<code>{{ url('/atom', {'key': user.api_key}) }}</code>
|
||||||
{% if has_permission_to('user_meetings') %}
|
{% if can('user_meetings') %}
|
||||||
<br><code>{{ url('/atom', {'meetings': 1, 'key': user.api_key}) }}</code>
|
<br><code>{{ url('/atom', {'meetings': 1, 'key': user.api_key}) }}</code>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<br><code>{{ url('/rss', {'key': user.api_key}) }}</code>
|
<br><code>{{ url('/rss', {'key': user.api_key}) }}</code>
|
||||||
{% if has_permission_to('user_meetings') %}
|
{% if can('user_meetings') %}
|
||||||
<br><code>{{ url('/rss', {'meetings': 1, 'key': user.api_key}) }}</code>
|
<br><code>{{ url('/rss', {'meetings': 1, 'key': user.api_key}) }}</code>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</p>
|
</p>
|
||||||
|
@ -95,7 +95,7 @@
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-12">
|
<div class="col-md-12">
|
||||||
{% if has_permission_to('api') %}
|
{% if can('api') %}
|
||||||
{{ __('settings.api.about', [
|
{{ __('settings.api.about', [
|
||||||
config('app_name'),
|
config('app_name'),
|
||||||
url('/api/v0-beta'),
|
url('/api/v0-beta'),
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
<div class="col-md-3 settings-menu">
|
<div class="col-md-3 settings-menu">
|
||||||
<ul class="nav nav-pills flex-column mt-3 user-settings">
|
<ul class="nav nav-pills flex-column mt-3 user-settings">
|
||||||
{% for url,title in settings_menu %}
|
{% for url,title in settings_menu %}
|
||||||
{% if not title.permission|default(false) or has_permission_to(title.permission) %}
|
{% if not title.permission|default(false) or can(title.permission) %}
|
||||||
<li class="nav-item{% if title.hidden|default(false) and url != request.url() %} d-none{% endif %}">
|
<li class="nav-item{% if title.hidden|default(false) and url != request.url() %} d-none{% endif %}">
|
||||||
<a class="nav-link {% if url == request.url() %}active{% endif %}" href="{{ url }}">
|
<a class="nav-link {% if url == request.url() %}active{% endif %}" href="{{ url }}">
|
||||||
{{ m.icon(title.icon ?? 'gear-fill') }}
|
{{ m.icon(title.icon ?? 'gear-fill') }}
|
||||||
|
|
|
@ -22,8 +22,8 @@ class Authentication extends TwigExtension
|
||||||
return [
|
return [
|
||||||
new TwigFunction('is_user', [$this, 'isAuthenticated']),
|
new TwigFunction('is_user', [$this, 'isAuthenticated']),
|
||||||
new TwigFunction('is_guest', [$this, 'isGuest']),
|
new TwigFunction('is_guest', [$this, 'isGuest']),
|
||||||
new TwigFunction('has_permission_to', [$this->auth, 'can']),
|
new TwigFunction('can', [$this->auth, 'can']),
|
||||||
new TwigFunction('has_permission_to_any', [$this->auth, 'canAny']),
|
new TwigFunction('canAny', [$this->auth, 'canAny']),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -25,8 +25,8 @@ class AuthenticationTest extends ExtensionTest
|
||||||
|
|
||||||
$this->assertExtensionExists('is_user', [$extension, 'isAuthenticated'], $functions);
|
$this->assertExtensionExists('is_user', [$extension, 'isAuthenticated'], $functions);
|
||||||
$this->assertExtensionExists('is_guest', [$extension, 'isGuest'], $functions);
|
$this->assertExtensionExists('is_guest', [$extension, 'isGuest'], $functions);
|
||||||
$this->assertExtensionExists('has_permission_to', [$auth, 'can'], $functions);
|
$this->assertExtensionExists('can', [$auth, 'can'], $functions);
|
||||||
$this->assertExtensionExists('has_permission_to_any', [$auth, 'canAny'], $functions);
|
$this->assertExtensionExists('canAny', [$auth, 'canAny'], $functions);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue