142
|
1 |
<? |
|
2 |
|
|
3 |
|
|
4 |
$def_tables = |
|
5 |
array( |
|
6 |
array( |
|
7 |
'table_name' => 'perm_items', |
|
8 |
'fields' => array( |
|
9 |
'id' => array( |
|
10 |
'type' => 'integer', |
|
11 |
'notnull' => 1, |
|
12 |
'length' => 4, |
|
13 |
'unsigned' => 0, |
|
14 |
'autoincrement' => 1, |
|
15 |
'name' => 'id', |
|
16 |
'table' => 'perm_items', |
|
17 |
'flags' => 'primary_keynot_null' |
|
18 |
), |
|
19 |
'name' => array( |
|
20 |
'type' => 'text', |
|
21 |
'notnull' => 1, |
|
22 |
'length' => 64, |
|
23 |
'fixed' => 0, |
|
24 |
'default' => 0, |
|
25 |
'name' => 'name', |
|
26 |
'table' => 'perm_items', |
|
27 |
'flags' => 'not_null' |
|
28 |
), |
|
29 |
'descr' => array( |
|
30 |
'type' => 'text', |
|
31 |
'length' => 1024, |
|
32 |
'notnull' => 1, |
|
33 |
'fixed' => 0, |
|
34 |
'default' => 0, |
|
35 |
'name' => 'descr', |
|
36 |
'table' => 'perm_items', |
|
37 |
'flags' => 'not_null' |
|
38 |
) |
|
39 |
) |
|
40 |
), |
|
41 |
array( |
|
42 |
'table_name' => 'perm_templ', |
|
43 |
'fields' => array( |
|
44 |
'id' => array( |
|
45 |
'type' => 'integer', |
|
46 |
'notnull' => 1, |
|
47 |
'length' => 4, |
|
48 |
'unsigned' => 0, |
|
49 |
'default' => 0, |
|
50 |
'autoincrement' => 1, |
|
51 |
'name' => 'id', |
|
52 |
'table' => 'perm_templ', |
|
53 |
'flags' => 'primary_keynot_null' |
|
54 |
), |
|
55 |
'name' => array( |
145
|
56 |
'type' => 'text', |
142
|
57 |
'notnull' => 1, |
|
58 |
'length' => 128, |
|
59 |
'fixed' => 0, |
|
60 |
'default' => 0, |
|
61 |
'name' => 'name', |
|
62 |
'table' => 'perm_templ', |
|
63 |
'flags' => 'not_null' |
|
64 |
), |
|
65 |
'descr' => array( |
|
66 |
'notnull' => 1, |
|
67 |
'fixed' => 0, |
|
68 |
'default' => 0, |
|
69 |
'type' => 'text', |
|
70 |
'length' => 1024, |
|
71 |
'name' => 'descr', |
|
72 |
'table' => 'perm_templ', |
|
73 |
'flags' => 'not_null' |
|
74 |
) |
|
75 |
) |
|
76 |
), |
|
77 |
array( |
|
78 |
'table_name' => 'perm_templ_items', |
|
79 |
'fields' => array( |
|
80 |
'id' => array( |
|
81 |
'notnull' => 1, |
|
82 |
'length' => 4, |
|
83 |
'unsigned' => 0, |
|
84 |
'default' => 0, |
|
85 |
'autoincrement' => 1, |
|
86 |
'type' => 'integer', |
|
87 |
'name' => 'id', |
|
88 |
'table' => 'perm_templ_items', |
|
89 |
'flags' => 'primary_keynot_null' |
|
90 |
), |
|
91 |
'templ_id' => array( |
|
92 |
'notnull' => 1, |
|
93 |
'length' => 4, |
|
94 |
'unsigned' => 0, |
|
95 |
'default' => 0, |
|
96 |
'type' => 'integer', |
|
97 |
'name' => 'templ_id', |
|
98 |
'table' => 'perm_templ_items', |
|
99 |
'flags' => 'not_null' |
|
100 |
), |
|
101 |
'perm_id' => array( |
|
102 |
'notnull' => 1, |
|
103 |
'length' => 4, |
|
104 |
'unsigned' => 0, |
|
105 |
'default' => 0, |
|
106 |
'type' => 'integer', |
|
107 |
'name' => 'perm_id', |
|
108 |
'table' => 'perm_templ_items', |
|
109 |
'flags' => 'not_null' |
|
110 |
) |
|
111 |
) |
|
112 |
), |
|
113 |
array( |
|
114 |
'table_name' => 'users', |
|
115 |
'fields' => array( |
|
116 |
'id' => array |
|
117 |
( |
|
118 |
'notnull' => 1, |
|
119 |
'length' => 4, |
|
120 |
'unsigned' => 0, |
|
121 |
'default' => 0, |
|
122 |
'autoincrement' => 1, |
|
123 |
'type' => 'integer', |
|
124 |
'name' => 'id', |
|
125 |
'table' => 'users', |
|
126 |
'flags' => 'primary_keynot_null' |
|
127 |
), |
|
128 |
'username' => array |
|
129 |
( |
|
130 |
'notnull' => 1, |
|
131 |
'length' => 16, |
|
132 |
'fixed' => 0, |
|
133 |
'default' => 0, |
|
134 |
'type' => 'text', |
|
135 |
'name' => 'username', |
|
136 |
'table' => 'users', |
|
137 |
'flags' => 'not_null' |
|
138 |
), |
|
139 |
'password' => array |
|
140 |
( |
|
141 |
'notnull' => 1, |
|
142 |
'length' => 34, |
|
143 |
'fixed' => 0, |
|
144 |
'default' => 0, |
|
145 |
'type' => 'text', |
|
146 |
'name' => 'password', |
|
147 |
'table' => 'users', |
|
148 |
'flags' => 'not_null' |
|
149 |
), |
|
150 |
'fullname' => array |
|
151 |
( |
|
152 |
'notnull' => 1, |
|
153 |
'length' => 255, |
|
154 |
'fixed' => 0, |
|
155 |
'default' => 0, |
|
156 |
'type' => 'text', |
|
157 |
'name' => 'fullname', |
|
158 |
'table' => 'users', |
|
159 |
'flags' => 'not_null' |
|
160 |
), |
|
161 |
'email' => array |
|
162 |
( |
|
163 |
'notnull' => 1, |
|
164 |
'length' => 255, |
|
165 |
'fixed' => 0, |
|
166 |
'default' => 0, |
|
167 |
'type' => 'text', |
|
168 |
'name' => 'email', |
|
169 |
'table' => 'users', |
|
170 |
'flags' => 'not_null' |
|
171 |
), |
|
172 |
'description' => array |
|
173 |
( |
|
174 |
'notnull' => 1, |
|
175 |
'fixed' => 0, |
|
176 |
'default' => 0, |
|
177 |
'type' => 'text', |
|
178 |
'length' => 1024, |
|
179 |
'name' => 'description', |
|
180 |
'table' => 'users', |
|
181 |
'flags' => 'not_null' |
|
182 |
), |
|
183 |
'perm_templ' => array |
|
184 |
( |
|
185 |
'notnull' => 1, |
|
186 |
'length' => 1, |
|
187 |
'unsigned' => 0, |
|
188 |
'default' => 0, |
|
189 |
'type' => 'integer', |
|
190 |
'name' => 'perm_templ', |
|
191 |
'table' => 'users', |
|
192 |
'flags' => 'not_null' |
|
193 |
), |
|
194 |
'active' => array |
|
195 |
( |
|
196 |
'notnull' => 1, |
|
197 |
'length' => 1, |
|
198 |
'unsigned' => 0, |
|
199 |
'default' => 0, |
|
200 |
'type' => 'integer', |
|
201 |
'name' => 'active', |
|
202 |
'table' => 'users', |
|
203 |
'flags' => 'not_null' |
|
204 |
) |
|
205 |
) |
|
206 |
), |
|
207 |
array( |
|
208 |
'table_name' => 'zones', |
|
209 |
'fields' => array( |
|
210 |
'id' => array |
|
211 |
( |
|
212 |
'notnull' => 1, |
|
213 |
'length' => 4, |
|
214 |
'unsigned' => 0, |
|
215 |
'default' => 0, |
|
216 |
'autoincrement' => 1, |
|
217 |
'type' => 'integer', |
|
218 |
'name' => 'id', |
|
219 |
'table' => 'zones', |
|
220 |
'flags' => 'primary_keynot_null' |
|
221 |
), |
|
222 |
'domain_id' => array |
|
223 |
( |
|
224 |
'notnull' => 1, |
|
225 |
'length' => 4, |
|
226 |
'unsigned' => 0, |
|
227 |
'default' => 0, |
|
228 |
'type' => 'integer', |
|
229 |
'name' => 'domain_id', |
|
230 |
'table' => 'zones', |
|
231 |
'flags' => 'not_null' |
|
232 |
), |
|
233 |
'owner' => array |
|
234 |
( |
|
235 |
'notnull' => 1, |
|
236 |
'length' => 4, |
|
237 |
'unsigned' => 0, |
|
238 |
'default' => 0, |
|
239 |
'type' => 'integer', |
|
240 |
'name' => 'owner', |
|
241 |
'table' => 'zones', |
|
242 |
'flags' => 'not_null' |
|
243 |
), |
|
244 |
'comment' => array |
|
245 |
( |
|
246 |
'notnull' => 0, |
|
247 |
'length' => 1024, |
|
248 |
'fixed' => 0, |
|
249 |
'default' => 0, |
|
250 |
'type' => 'text', |
|
251 |
'name' => 'comment', |
|
252 |
'table' => 'zones', |
|
253 |
'flags' => '' |
|
254 |
) |
|
255 |
) |
|
256 |
) |
|
257 |
); |
|
258 |
|
189
|
259 |
// Tables from PowerDNS |
|
260 |
$grantTables = array('supermasters', 'domains', 'records'); |
|
261 |
// Include PowerAdmin tables |
|
262 |
foreach($def_tables as $table) { |
|
263 |
$grantTables[] = $table['table_name']; |
|
264 |
} |
|
265 |
|
142
|
266 |
$def_permissions = array( |
|
267 |
array(41,'zone_master_add','User is allowed to add new master zones.'), |
|
268 |
array(42,'zone_slave_add','User is allowed to add new slave zones.'), |
|
269 |
array(43,'zone_content_view_own','User is allowed to see the content and meta data of zones he owns.'), |
|
270 |
array(44,'zone_content_edit_own','User is allowed to edit the content of zones he owns.'), |
|
271 |
array(45,'zone_meta_edit_own','User is allowed to edit the meta data of zones he owns.'), |
|
272 |
array(46,'zone_content_view_others','User is allowed to see the content and meta data of zones he does not own.'), |
|
273 |
array(47,'zone_content_edit_others','User is allowed to edit the content of zones he does not own.'), |
|
274 |
array(48,'zone_meta_edit_others','User is allowed to edit the meta data of zones he does not own.'), |
|
275 |
array(49,'search','User is allowed to perform searches.'), |
|
276 |
array(50,'supermaster_view','User is allowed to view supermasters.'), |
|
277 |
array(51,'supermaster_add','User is allowed to add new supermasters.'), |
|
278 |
array(52,'supermaster_edit','User is allowed to edit supermasters.'), |
|
279 |
array(53,'user_is_ueberuser','User has full access. God-like. Redeemer.'), |
|
280 |
array(54,'user_view_others','User is allowed to see other users and their details.'), |
|
281 |
array(55,'user_add_new','User is allowed to add new users.'), |
|
282 |
array(56,'user_edit_own','User is allowed to edit their own details.'), |
|
283 |
array(57,'user_edit_others','User is allowed to edit other users.'), |
|
284 |
array(58,'user_passwd_edit_others','User is allowed to edit the password of other users.'), |
|
285 |
array(59,'user_edit_templ_perm','User is allowed to change the permission template that is assigned to a user.'), |
|
286 |
array(60,'templ_perm_add','User is allowed to add new permission templates.'), |
|
287 |
array(61,'templ_perm_edit','User is allowed to edit existing permission templates.') |
|
288 |
); |
|
289 |
|
|
290 |
$def_remaining_queries = array( |
165
|
291 |
"INSERT INTO users VALUES (1,'admin'," . $db->quote(md5($pa_pass)) . ",'Administrator','admin@example.net','Administrator with full rights.',1,1)", |
142
|
292 |
"INSERT INTO perm_templ VALUES (1,'Administrator','Administrator template with full rights.')", |
|
293 |
"INSERT INTO perm_templ_items VALUES (249,1,53)" |
|
294 |
); |
|
295 |
|
|
296 |
|
|
297 |
|