Rework permissions

This commit is contained in:
Julian Prieber 2024-12-16 14:28:08 +01:00
parent a477165188
commit 2e09416011

View File

@ -408,9 +408,7 @@
</a>
</li>
{{-- <! #### begin update detection #### > --}}
@if (auth()->user()->role == 'admin' &&
(env('NOTIFY_UPDATES') == 'true' or env('NOTIFY_UPDATES') === 'major' or env('NOTIFY_UPDATES') === 'all'))
@if (env('NOTIFY_UPDATES') == 'true' or env('NOTIFY_UPDATES') === 'major' or env('NOTIFY_UPDATES') === 'all')
{{-- <! Checks if file version.json exists AND if version.json exists on server to continue (without this PHP will throw ErrorException ) > --}}
@if (file_exists(base_path('version.json')))
@ -450,7 +448,7 @@
{{-- Notification Modals --}}
@push('sidebar-scripts')
@php
function notification($dismiss = '', $ntid, $heading, $body)
function notification($adminOnly = false, $dismiss = '', $ntid, $heading, $body)
{
$closeMSG = __('messages.Close');
$dismissMSG = __('messages.Dismiss');
@ -458,7 +456,7 @@
if ($dismiss) {
$dismissBtn = '<a href="' . url()->current() . '?dismiss=' . $dismiss . '" class="btn btn-danger">' . $dismissMSG . '</a>';
}
echo <<<MODAL
$body = <<<MODAL
<div class="modal fade" id="$ntid" data-bs-backdrop="true" data-bs-keyboard="false" tabindex="-1" aria-labelledby="${ntid}-label" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
@ -478,15 +476,20 @@
</div>
</div>
</div>
MODAL; // Indentation breaks my code editor :/
MODAL; // <-- Indentation breaks my code editor :/
if (!$adminOnly || Auth::user()->role == 'admin') {
echo $body;
}
notification('', 'modal-1', __('messages.Your security is at risk!'), '<b>' . __('messages.security.msg1') . '</b> ' . __('messages.security.msg2') . '<br><br>' . __('messages.security.msg3') . '<br><a href="' . url('admin/config#5') . '">' . __('messages.security.msg3') . '</a>.');
notification('hide-star-notification', 'modal-star', __('messages.Support Linkstack'), '' . __('messages.support.msg1') . ' <a target="_blank" href="https://github.com/linkstackorg/linkstack">' . __('messages.support.msg2') . '</a>. ' . __('messages.support.msg3') . '<br><br>' . __('messages.support.msg4') . ' <a target="_blank" href="https://linkstack.org/donate">' . __('messages.support.msg5') . '<br><br>' . __('messages.support.msg6') . '');
}
notification(true, '', 'modal-1', __('messages.Your security is at risk!'), '<b>' . __('messages.security.msg1') . '</b> ' . __('messages.security.msg2') . '<br><br>' . __('messages.security.msg3') . '<br><a href="' . url('admin/config#5') . '">' . __('messages.security.msg3') . '</a>.');
notification(true, 'hide-star-notification', 'modal-star', __('messages.Support Linkstack'), '' . __('messages.support.msg1') . ' <a target="_blank" href="https://github.com/linkstackorg/linkstack">' . __('messages.support.msg2') . '</a>. ' . __('messages.support.msg3') . '<br><br>' . __('messages.support.msg4') . ' <a target="_blank" href="https://linkstack.org/donate">' . __('messages.support.msg5') . '<br><br>' . __('messages.support.msg6') . '');
@endphp
@endpush
@if (auth()->user()->role == 'admin')
{{-- <! #### begin update detection #### > --}}
@if(auth()->user()->role == 'admin')
@push('sidebar-scripts')
<script>
const isVisible = true;
@ -681,10 +684,12 @@ MODAL; // Indentation breaks my code editor :/
</div>
</li>
@endif
@endif
@endif
{{-- <! #### end update detection #### > --}}
@endif
@endif
<li class="nav-item dropdown">
<a class="py-0 nav-link d-flex align-items-center dropdown-toggle" href="#"
id="navbarDropdown" role="button" data-bs-toggle="dropdown"