1+ # Copyright © 2023 Fernando Porrino Serrano
2+ # Third party software licenses can be found at /docs/credits/credits.md
3+
4+ # This file is part of AutoCheck.
5+
6+ # AutoCheck is free software: you can redistribute it and/or modify
7+ # it under the terms of the GNU Affero General Public License as published by
8+ # the Free Software Foundation, either version 3 of the License, or
9+ # (at your option) any later version.
10+
11+ # AutoCheck is distributed in the hope that it will be useful,
12+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
13+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14+ # GNU Affero General Public License for more details.
15+
16+ # You should have received a copy of the GNU Affero General Public License
17+ # along with AutoCheck. If not, see <https://www.gnu.org/licenses/>.
18+
19+ name : " ASIX - M02 (UF3): Permissions Assignment (Recuperació)"
20+ version : " 1.0.0.0"
21+
22+ # TODO: permission reset should be performed ONLY when running on batch mode and ONLY when importing an SQL dump... When using directly over an existing BBDD, it should be just READ ONLY.
23+
24+ body :
25+ - connector :
26+ type : " Postgres"
27+ arguments : " --host {$CURRENT_HOST} --database {$DATABASE} --username {$CURRENT_USER} --password {$CURRENT_PASSWORD}"
28+
29+ - question :
30+ description : " This questions does not score"
31+ score : 0
32+ content :
33+ - run : " echo dummy" # dummy question, just for matching with the assignment rubric
34+
35+ - question :
36+ description : " Foreign key (I)"
37+ score : 1
38+ content :
39+ - run :
40+ caption : " Checking foreign key 'professors -> professors'..."
41+ connector : " Postgres"
42+ command : " ExistsForeignKey"
43+ arguments : " --schemaFrom secretaria --tableFrom professors --columnFrom id_cap --schemaTo secretaria --tableTo professors --columnTo id"
44+ expected : True
45+
46+ - question :
47+ description : " Privileges over 'grups'"
48+ score : 2
49+ content :
50+ - run :
51+ caption : " Checking schema privileges..."
52+ connector : " Postgres"
53+ command : " GetSchemaPrivileges"
54+ arguments : " --schema organitzacio --role capestudis"
55+ expected : " %U%"
56+
57+ - run :
58+ caption : " Checking table privileges..."
59+ connector : " Postgres"
60+ command : " GetTablePrivileges"
61+ arguments : " --schema organitzacio --table grups --role secretari"
62+ expected : " %a%"
63+
64+ - question :
65+ description : " Privileges over 'grups'"
66+ score : 2
67+ content :
68+ - run :
69+ caption : " Checking table privileges..."
70+ connector : " Postgres"
71+ command : " GetTablePrivileges"
72+ arguments : " --schema secretaria --table professors --role capestudis"
73+ expected : " %x%"
74+
75+ - run :
76+ caption : " Checking foreign key 'grups -> aules'..."
77+ connector : " Postgres"
78+ command : " ExistsForeignKey"
79+ arguments : " --schemaFrom organitzacio --tableFrom grups --columnFrom id_aula --schemaTo organitzacio --tableTo aules --columnTo id"
80+ expected : True
81+
82+ - run :
83+ caption : " Checking foreign key 'grups -> professors'..."
84+ connector : " Postgres"
85+ command : " ExistsForeignKey"
86+ arguments : " --schemaFrom organitzacio --tableFrom grups --columnFrom id_tutor --schemaTo secretaria --tableTo professors --columnTo id"
87+ expected : True
88+
89+ - question :
90+ description : " Privileges for admin"
91+ score : 3
92+ content :
93+ - run :
94+ caption : " Checking 'admin' privileges for the table 'ubicacions'..."
95+ connector : " Postgres"
96+ command : " GetTablePrivileges"
97+ arguments : " --schema organitzacio --table ubicacions --role admin"
98+ expected : " dD"
99+
100+ - run :
101+ caption : " Checking 'capestudis' privileges for the table 'ubicacions'..."
102+ connector : " Postgres"
103+ command : " GetTablePrivileges"
104+ arguments : " --schema organitzacio --table ubicacions --role capestudis"
105+ expected : " arwxt"
0 commit comments