Skip to content

Commit

Permalink
Tables: Roles and applications
Browse files Browse the repository at this point in the history
Backend:
  - Added the Role and Applications tables
  • Loading branch information
fet1sov committed May 1, 2024
1 parent 79885c6 commit 53ba67d
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 3 deletions.
Empty file added README.md
Empty file.
2 changes: 1 addition & 1 deletion www/data/locales/ru-RU.json
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@
},
"userMenu": {
"personalCabinet": "Личный кабинет",
"admin": "Администрирование",
"admin": "Админ",
"settings": "Настройки",
"logout": "Выйти"
},
Expand Down
3 changes: 2 additions & 1 deletion www/frontend/components/elems/header.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,12 @@

<li>
<a href="/admin">

<svg fill="#000000" viewBox="0 0 1920 1920" xmlns="http://www.w3.org/2000/svg"><g id="SVGRepo_bgCarrier" stroke-width="0"></g><g id="SVGRepo_tracerCarrier" stroke-linecap="round" stroke-linejoin="round"></g><g id="SVGRepo_iconCarrier"> <path d="M983.727 5.421 1723.04 353.62c19.765 9.374 32.414 29.252 32.414 51.162v601.525c0 489.6-424.207 719.774-733.779 887.943l-34.899 18.975c-8.47 4.517-17.731 6.889-27.105 6.889-9.262 0-18.523-2.372-26.993-6.89l-34.9-18.974C588.095 1726.08 164 1495.906 164 1006.306V404.78c0-21.91 12.65-41.788 32.414-51.162L935.727 5.42c15.134-7.228 32.866-7.228 48 0ZM757.088 383.322c-176.075 0-319.285 143.323-319.285 319.398 0 176.075 143.21 319.285 319.285 319.285 1.92 0 3.84 0 5.76-.113l58.504 58.503h83.689v116.781h116.781v83.803l91.595 91.482h313.412V1059.05l-350.57-350.682c.114-1.807.114-3.727.114-5.647 0-176.075-143.21-319.398-319.285-319.398Zm0 112.942c113.732 0 206.344 92.724 205.327 216.62l-3.953 37.271 355.426 355.652v153.713h-153.713l-25.412-25.299v-149.986h-116.78v-116.78H868.108l-63.812-63.7-47.209 5.309c-113.732 0-206.344-92.5-206.344-206.344 0-113.732 92.612-206.456 206.344-206.456Zm4.98 124.98c-46.757 0-84.705 37.948-84.705 84.706s37.948 84.706 84.706 84.706c46.757 0 84.706-37.948 84.706-84.706s-37.949-84.706-84.706-84.706Z" fill-rule="evenodd"></path> </g></svg>
<div><?= $GLOBALS["locale"]["userMenu"]["admin"] ?></div>
</a>
</li>


<li>
<a href="/user/settings">
<svg height="200px" width="200px" version="1.1" id="_x32_" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 512 512" xml:space="preserve" fill="#000000"><g id="SVGRepo_bgCarrier" stroke-width="0"></g><g id="SVGRepo_tracerCarrier" stroke-linecap="round" stroke-linejoin="round"></g><g id="SVGRepo_iconCarrier"> <style type="text/css"> .st0{fill:#000000;} </style> <g> <path class="st0" d="M502.325,307.303l-39.006-30.805c-6.215-4.908-9.665-12.429-9.668-20.348c0-0.084,0-0.168,0-0.252 c-0.014-7.936,3.44-15.478,9.667-20.396l39.007-30.806c8.933-7.055,12.093-19.185,7.737-29.701l-17.134-41.366 c-4.356-10.516-15.167-16.86-26.472-15.532l-49.366,5.8c-7.881,0.926-15.656-1.966-21.258-7.586 c-0.059-0.06-0.118-0.119-0.177-0.178c-5.597-5.602-8.476-13.36-7.552-21.225l5.799-49.363 c1.328-11.305-5.015-22.116-15.531-26.472L337.004,1.939c-10.516-4.356-22.646-1.196-29.701,7.736l-30.805,39.005 c-4.908,6.215-12.43,9.665-20.349,9.668c-0.084,0-0.168,0-0.252,0c-7.935,0.014-15.477-3.44-20.395-9.667L204.697,9.675 c-7.055-8.933-19.185-12.092-29.702-7.736L133.63,19.072c-10.516,4.356-16.86,15.167-15.532,26.473l5.799,49.366 c0.926,7.881-1.964,15.656-7.585,21.257c-0.059,0.059-0.118,0.118-0.178,0.178c-5.602,5.598-13.36,8.477-21.226,7.552 l-49.363-5.799c-11.305-1.328-22.116,5.015-26.472,15.531L1.939,174.996c-4.356,10.516-1.196,22.646,7.736,29.701l39.006,30.805 c6.215,4.908,9.665,12.429,9.668,20.348c0,0.084,0,0.167,0,0.251c0.014,7.935-3.44,15.477-9.667,20.395L9.675,307.303 c-8.933,7.055-12.092,19.185-7.736,29.701l17.134,41.365c4.356,10.516,15.168,16.86,26.472,15.532l49.366-5.799 c7.882-0.926,15.656,1.965,21.258,7.586c0.059,0.059,0.118,0.119,0.178,0.178c5.597,5.603,8.476,13.36,7.552,21.226l-5.799,49.364 c-1.328,11.305,5.015,22.116,15.532,26.472l41.366,17.134c10.516,4.356,22.646,1.196,29.701-7.736l30.804-39.005 c4.908-6.215,12.43-9.665,20.348-9.669c0.084,0,0.168,0,0.251,0c7.936-0.014,15.478,3.44,20.396,9.667l30.806,39.007 c7.055,8.933,19.185,12.093,29.701,7.736l41.366-17.134c10.516-4.356,16.86-15.168,15.532-26.472l-5.8-49.366 c-0.926-7.881,1.965-15.656,7.586-21.257c0.059-0.059,0.119-0.119,0.178-0.178c5.602-5.597,13.36-8.476,21.225-7.552l49.364,5.799 c11.305,1.328,22.117-5.015,26.472-15.531l17.134-41.365C514.418,326.488,511.258,314.358,502.325,307.303z M281.292,329.698 c-39.68,16.436-85.172-2.407-101.607-42.087c-16.436-39.68,2.407-85.171,42.087-101.608c39.68-16.436,85.172,2.407,101.608,42.088 C339.815,267.771,320.972,313.262,281.292,329.698z"></path> </g> </g></svg>
Expand Down
27 changes: 26 additions & 1 deletion www/includes/wtframework/database/db_connect.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,38 @@

/* ============= USER TABLE ============== */
try {
$stmt = $GLOBALS["dbAdapter"]->prepare('
CREATE TABLE IF NOT EXISTS `applications` (
`id` int NOT NULL COMMENT \'Application ID\' AUTO_INCREMENT,
`author_id` int NOT NULL COMMENT \'Application author ID (user.id)\',
`manager_id` int COMMENT \'Manager ID (user.id)\',
FOREIGN KEY (`author_id`) REFERENCES `user`(`id`),
FOREIGN KEY (`manager_id`) REFERENCES `user`(`id`),
PRIMARY KEY (`id`)
);
');
$stmt->execute();

$stmt = $GLOBALS["dbAdapter"]->prepare('
CREATE TABLE IF NOT EXISTS `role` (
`id` int NOT NULL COMMENT \'Role ID\' AUTO_INCREMENT,
`name` varchar(255) NOT NULL COMMENT \'Role name\',
`admin_rights` int COMMENT \'Admin rights\',
`applications_list` int COMMENT \'Access to applications list\',
PRIMARY KEY (`id`)
);
');
$stmt->execute();

$stmt = $GLOBALS["dbAdapter"]->prepare('
CREATE TABLE IF NOT EXISTS `user` (
`id` int NOT NULL COMMENT \'ID user\' AUTO_INCREMENT,
`id` int NOT NULL COMMENT \'User ID\' AUTO_INCREMENT,
`username` varchar(32) NOT NULL UNIQUE COMMENT \'Username\',
`password` varchar(255) NOT NULL COMMENT \'Password MD5 Hash\',
`company` varchar(255) DEFAULT NULL COMMENT \'Company name\',
`email` varchar(128) NOT NULL UNIQUE COMMENT \'Contact e-mail\',
`role_id` int DEFAULT NULL COMMENT \'Role ID\',
FOREIGN KEY (`role_id`) REFERENCES `role`(`id`),
PRIMARY KEY (`id`)
);
');
Expand Down

0 comments on commit 53ba67d

Please sign in to comment.