feat: Implement module permissions system with database-driven access control

- Added `users_permissions` table for managing user permissions.
- Created `PermissionRepository` for handling permission logic.
- Refactored `controls\Users::permissions()` to utilize the new database structure.
- Introduced AJAX endpoint for saving user permissions.
- Enhanced user management UI with permission checkboxes.
- Added vacation management template for handling employee absences.
- Implemented tests for `PermissionRepository`.
This commit is contained in:
2026-02-26 20:17:03 +01:00
parent 76d3ac33a8
commit a4a35c8d62
35 changed files with 2654 additions and 901 deletions

View File

@@ -1,75 +1,31 @@
<div class="row">
<div class="col-12 col-md-6">
<div class="g-container">
<div class="block-header">
<h2>pushover <strong>API</strong></h2>
<small class="text-muted">uzupełnił dane potrzebne do wysyłania powiadomień PUSH</small>
</div>
<div id="g-form-container">
<form method="POST" id="pushover-settings" class="g-form form-horizontal" action="/users/settings_save/">
<?= \Html::input( [
'label' => 'Pushover API',
'name' => 'pushover_api',
'value' => $this -> user['pushover_api'],
'inline' => false
]
);?>
<?= \Html::input( [
'label' => 'Pushover User',
'name' => 'pushover_user',
'value' => $this -> user['pushover_user'],
'inline' => false
]
);?>
<?= \Html::button( [
'class' => 'btn-success',
'text' => 'Zapisz ustawienia',
'icon' => 'fa-check',
'js' => '$( "#pushover-settings" ).submit();'
]
);?>
</form>
</div>
</div>
<div class="card" style="max-width: 500px;">
<div class="card-header">
<i class="fa fa-lock"></i> Zmiana hasła
</div>
<div class="col-12 col-md-6">
<div class="g-container">
<div class="block-header">
<h2>zmiana <strong>hasła</strong></h2>
<small class="text-muted">zmień swoje stare hasło na nowe</small>
<div class="card-body">
<form method="POST" id="password-settings" action="/users/password_change/">
<div class="form-field">
<label>Stare hasło</label>
<div class="password-wrap">
<input type="password" name="password_old" id="password_old" class="form-control" required>
<a href="#" class="password-eye" onclick="password_toggle( $(this).children('i'), 'password_old' ); return false;">
<i class="fa fa-eye"></i>
</a>
</div>
</div>
<div id="g-form-container">
<form method="POST" id="password-settings" class="g-form form-horizontal" action="/users/password_change/">
<?= \Html::input_icon( [
'label' => 'Stare hasło',
'name' => 'password_old',
'type' => 'password',
'inline' => false,
'required' => true,
'icon_content' => '<i class="fa fa-eye"></i>',
'icon_js' => 'password_toggle( $( this ).children( "i" ), "password_old" ); return false;'
]
);?>
<?= \Html::input_icon( [
'label' => 'Nowe hasło',
'name' => 'password_new',
'type' => 'password',
'inline' => false,
'required' => true,
'icon_content' => '<i class="fa fa-eye"></i>',
'icon_js' => 'password_toggle( $( this ).children( "i" ), "password_new" ); return false;'
]
);?>
<?= \Html::button( [
'class' => 'btn-success',
'type' => 'submit',
'text' => 'Zmień hasło',
'icon' => 'fa-check'
]
);?>
</form>
<div class="form-field">
<label>Nowe hasło</label>
<div class="password-wrap">
<input type="password" name="password_new" id="password_new" class="form-control" required>
<a href="#" class="password-eye" onclick="password_toggle( $(this).children('i'), 'password_new' ); return false;">
<i class="fa fa-eye"></i>
</a>
</div>
</div>
</div>
<button type="submit" class="btn btn-success" style="margin-top: 10px;">
<i class="fa fa-check"></i> Zmień hasło
</button>
</form>
</div>
</div>
<script type="text/javascript">
@@ -81,4 +37,4 @@
else
$( '#' + id ).attr( 'type', 'password' );
}
</script>
</script>