From a6dbeaf2cd1b7b48eba8c94ecf170d77ca26ff76 Mon Sep 17 00:00:00 2001 From: lewmilburn <63267144+lewmilburn@users.noreply.github.com> Date: Tue, 11 Jun 2024 22:48:11 +0100 Subject: [PATCH] Add permissions. --- Content/Text/ABOUT.txt | 2 +- Processes/POST/Register.php | 13 +++++++++++++ Views/Dashboard.php | 7 ++++++- 3 files changed, 20 insertions(+), 2 deletions(-) diff --git a/Content/Text/ABOUT.txt b/Content/Text/ABOUT.txt index 7bb0526..b9efc5b 100644 --- a/Content/Text/ABOUT.txt +++ b/Content/Text/ABOUT.txt @@ -1 +1 @@ -This is the default about text for this website. You can change it in your settings. \ No newline at end of file +PeopleHive is an open-source HR system designed to be simple and easy to use. This is the default about test and can be changed in your system settings. \ No newline at end of file diff --git a/Processes/POST/Register.php b/Processes/POST/Register.php index cd8e649..100df6f 100644 --- a/Processes/POST/Register.php +++ b/Processes/POST/Register.php @@ -77,5 +77,18 @@ exit; } +if (!$SQL->Query("INSERT INTO `user_permissions` + (`id`, `uuid`, `access-holidays`, `manage-vacancies`, `manage-system-settings`) + VALUES + ( + NULL, + '{$SQL->Escape($uuid)}', + false,false,false + ) +")) { + header('Location: /register?error=database'); + exit; +} + header('Location: /login'); exit; \ No newline at end of file diff --git a/Views/Dashboard.php b/Views/Dashboard.php index b5664bd..b406021 100644 --- a/Views/Dashboard.php +++ b/Views/Dashboard.php @@ -31,13 +31,18 @@ = 1) { ?> My Job My Documents + hasPermission('access-holidays')) { ?> Holidays + Vacancies - = 2) { ?> + hasPermission('manage-vacancies')) { ?> Manage Vacancies + = 2) { ?> Department Overview Company Overview + hasPermission('manage-system-settings')) { ?> + System Settings