Skip to content

Commit 2b0ff11

Browse files
authored
Add responsibility description and granted date to responsibility table (#8)
Add responsibility description and granted date to responsibility management
1 parent 9be6067 commit 2b0ff11

File tree

3 files changed

+40
-37
lines changed

3 files changed

+40
-37
lines changed

database.sql

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,12 +59,14 @@ CREATE OR REPLACE TABLE person_setting (
5959

6060
CREATE OR REPLACE TABLE responsibility (
6161
responsibility_id INT AUTO_INCREMENT PRIMARY KEY,
62-
responsibility_name VARCHAR(100) UNIQUE
62+
responsibility_name VARCHAR(100) UNIQUE,
63+
responsibility_description TEXT
6364
) ENGINE = InnoDB;
6465

6566
CREATE OR REPLACE TABLE person_responsibility (
6667
person_id INT,
6768
responsibility_id INT,
69+
granted_date TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
6870
PRIMARY KEY (person_id, responsibility_id),
6971
FOREIGN KEY (person_id) REFERENCES person (person_id) ON DELETE CASCADE,
7072
FOREIGN KEY (responsibility_id) REFERENCES responsibility (responsibility_id) ON DELETE CASCADE

procedures/insert/responsibility.sql

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,12 @@ USE smartcooking;
44
DELIMITER //
55

66
CREATE OR REPLACE PROCEDURE insert_responsibility(
7-
IN p_responsibility_name VARCHAR(100)
7+
IN p_responsibility_name VARCHAR(100),
8+
IN p_responsibility_description TEXT
89
)
910
BEGIN
10-
INSERT INTO responsibility (responsibility_name)
11-
VALUES (p_responsibility_name);
11+
INSERT INTO responsibility (responsibility_name, responsibility_description)
12+
VALUES (p_responsibility_name, p_responsibility_description);
1213
END //
1314

1415
DELIMITER ;

setup/responsibility.sql

Lines changed: 33 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -2,54 +2,54 @@
22
USE smartcooking;
33

44
-- Administrative
5-
CALL insert_responsibility('can_manage_roles');
6-
CALL insert_responsibility('can_view_audit_log');
5+
CALL insert_responsibility('can_manage_roles', 'Allows the ability to create, edit, or delete user roles and their associated permissions.');
6+
CALL insert_responsibility('can_view_audit_log', 'Allows access to view detailed records of database activities and changes for auditing purposes.');
77

88
-- Category management
9-
CALL insert_responsibility('can_create_category');
10-
CALL insert_responsibility('can_edit_category');
11-
CALL insert_responsibility('can_delete_category');
9+
CALL insert_responsibility('can_create_category', 'Grants the ability to create new categories for organizing content.');
10+
CALL insert_responsibility('can_edit_category', 'Allows editing existing categories to update their details.');
11+
CALL insert_responsibility('can_delete_category', 'Grants permission to remove categories from the database.');
1212

1313
-- Comment management
14-
CALL insert_responsibility('can_comment_on_recipe');
15-
CALL insert_responsibility('can_edit_own_comment');
16-
CALL insert_responsibility('can_edit_any_comment');
17-
CALL insert_responsibility('can_delete_own_comment');
18-
CALL insert_responsibility('can_delete_any_comment');
14+
CALL insert_responsibility('can_comment_on_recipe', 'Enables the user to post comments on recipes.');
15+
CALL insert_responsibility('can_edit_own_comment', 'Allows users to edit their own comments.');
16+
CALL insert_responsibility('can_edit_any_comment', 'Grants the ability to modify any comment in the system.');
17+
CALL insert_responsibility('can_delete_own_comment', 'Enables users to delete their own comments.');
18+
CALL insert_responsibility('can_delete_any_comment', 'Grants the ability to remove any comment from the system.');
1919

2020
-- Ingredient management
21-
CALL insert_responsibility('can_create_ingredient');
22-
CALL insert_responsibility('can_edit_ingredient');
23-
CALL insert_responsibility('can_delete_ingredient');
21+
CALL insert_responsibility('can_create_ingredient', 'Allows the addition of new ingredients to the database.');
22+
CALL insert_responsibility('can_edit_ingredient', 'Grants permission to modify existing ingredient details.');
23+
CALL insert_responsibility('can_delete_ingredient', 'Allows the removal of ingredients from the database.');
2424

2525
-- Media management
26-
CALL insert_responsibility('can_upload_picture');
27-
CALL insert_responsibility('can_delete_picture');
26+
CALL insert_responsibility('can_upload_picture', 'Enables users to upload pictures to the system.');
27+
CALL insert_responsibility('can_delete_picture', 'Grants the ability to remove pictures from the system.');
2828

2929
-- Moderation
30-
CALL insert_responsibility('can_review_flagged_content');
31-
CALL insert_responsibility('can_suspend_user_account');
32-
CALL insert_responsibility('can_ban_user_account');
30+
CALL insert_responsibility('can_review_flagged_content', 'Allows reviewing and managing content flagged as inappropriate.');
31+
CALL insert_responsibility('can_suspend_user_account', 'Grants the ability to temporarily suspend a user’s account.');
32+
CALL insert_responsibility('can_ban_user_account', 'Enables the banning of user accounts permanently.');
3333

3434
-- Person management
35-
CALL insert_responsibility('can_manage_any_person_profile');
36-
CALL insert_responsibility('can_delete_any_person_account');
35+
CALL insert_responsibility('can_manage_any_person_profile', 'Grants access to edit profiles of any user in the system.');
36+
CALL insert_responsibility('can_delete_any_person_account', 'Allows the permanent removal of any user account.');
3737

3838
-- Recipe management
39-
CALL insert_responsibility('can_create_recipe');
40-
CALL insert_responsibility('can_edit_own_recipe');
41-
CALL insert_responsibility('can_edit_any_recipe');
42-
CALL insert_responsibility('can_delete_own_recipe');
43-
CALL insert_responsibility('can_delete_any_recipe');
44-
CALL insert_responsibility('can_publish_recipe');
45-
CALL insert_responsibility('can_review_recipe');
39+
CALL insert_responsibility('can_create_recipe', 'Allows users to create and submit new recipes.');
40+
CALL insert_responsibility('can_edit_own_recipe', 'Grants users the ability to edit their own recipes.');
41+
CALL insert_responsibility('can_edit_any_recipe', 'Allows editing any recipe in the system.');
42+
CALL insert_responsibility('can_delete_own_recipe', 'Enables users to delete their own recipes.');
43+
CALL insert_responsibility('can_delete_any_recipe', 'Grants the ability to remove any recipe from the system.');
44+
CALL insert_responsibility('can_publish_recipe', 'Allows the publication of recipes to make them publicly visible.');
45+
CALL insert_responsibility('can_review_recipe', 'Grants permission to review recipes for approval or feedback.');
4646

4747
-- Tag management
48-
CALL insert_responsibility('can_create_tag');
49-
CALL insert_responsibility('can_edit_tag');
50-
CALL insert_responsibility('can_delete_tag');
48+
CALL insert_responsibility('can_create_tag', 'Allows the creation of new tags for categorizing content.');
49+
CALL insert_responsibility('can_edit_tag', 'Grants the ability to edit existing tags.');
50+
CALL insert_responsibility('can_delete_tag', 'Allows the removal of tags from the database.');
5151

5252
-- Translation management
53-
CALL insert_responsibility('can_add_translation');
54-
CALL insert_responsibility('can_edit_translation');
55-
CALL insert_responsibility('can_delete_translation');
53+
CALL insert_responsibility('can_add_translation', 'Enables the addition of new translations for system content.');
54+
CALL insert_responsibility('can_edit_translation', 'Grants permission to modify existing translations.');
55+
CALL insert_responsibility('can_delete_translation', 'Allows the deletion of translations from the database.');

0 commit comments

Comments
 (0)