Passed
Push — newinternal-releasecandidate ( 40acd0...67549a )
by Simon
10:15
created
includes/Security/RoleConfiguration.php 1 patch
Indentation   +360 added lines, -360 removed lines patch added patch discarded remove patch
@@ -47,391 +47,391 @@
 block discarded – undo
47 47
 
48 48
 class RoleConfiguration
49 49
 {
50
-    const ACCESS_ALLOW = 1;
51
-    const ACCESS_DENY = -1;
52
-    const ACCESS_DEFAULT = 0;
53
-    const MAIN = 'main';
54
-    const ALL = '*';
55
-    /**
56
-     * A map of roles to rights
57
-     *
58
-     * For example:
59
-     *
60
-     * array(
61
-     *   'myrole' => array(
62
-     *       PageMyPage::class => array(
63
-     *           'edit' => self::ACCESS_ALLOW,
64
-     *           'create' => self::ACCESS_DENY,
65
-     *       )
66
-     *   )
67
-     * )
68
-     *
69
-     * Note that DENY takes precedence over everything else when roles are combined, followed by ALLOW, followed by
70
-     * DEFAULT. Thus, if you have the following ([A]llow, [D]eny, [-] (default)) grants in different roles, this should
71
-     * be the expected result:
72
-     *
73
-     * - (-,-,-) = - (default because nothing to explicitly say allowed or denied equates to a denial)
74
-     * - (A,-,-) = A
75
-     * - (D,-,-) = D
76
-     * - (A,D,-) = D (deny takes precedence over allow)
77
-     * - (A,A,A) = A (repetition has no effect)
78
-     *
79
-     * The public role is special, and is applied to all users automatically. Avoid using deny on this role.
80
-     *
81
-     * @var array
82
-     */
83
-    private $roleConfig = array(
84
-        'public'            => array(
85
-            /*
50
+	const ACCESS_ALLOW = 1;
51
+	const ACCESS_DENY = -1;
52
+	const ACCESS_DEFAULT = 0;
53
+	const MAIN = 'main';
54
+	const ALL = '*';
55
+	/**
56
+	 * A map of roles to rights
57
+	 *
58
+	 * For example:
59
+	 *
60
+	 * array(
61
+	 *   'myrole' => array(
62
+	 *       PageMyPage::class => array(
63
+	 *           'edit' => self::ACCESS_ALLOW,
64
+	 *           'create' => self::ACCESS_DENY,
65
+	 *       )
66
+	 *   )
67
+	 * )
68
+	 *
69
+	 * Note that DENY takes precedence over everything else when roles are combined, followed by ALLOW, followed by
70
+	 * DEFAULT. Thus, if you have the following ([A]llow, [D]eny, [-] (default)) grants in different roles, this should
71
+	 * be the expected result:
72
+	 *
73
+	 * - (-,-,-) = - (default because nothing to explicitly say allowed or denied equates to a denial)
74
+	 * - (A,-,-) = A
75
+	 * - (D,-,-) = D
76
+	 * - (A,D,-) = D (deny takes precedence over allow)
77
+	 * - (A,A,A) = A (repetition has no effect)
78
+	 *
79
+	 * The public role is special, and is applied to all users automatically. Avoid using deny on this role.
80
+	 *
81
+	 * @var array
82
+	 */
83
+	private $roleConfig = array(
84
+		'public'            => array(
85
+			/*
86 86
              * THIS ROLE IS GRANTED TO ALL LOGGED *OUT* USERS IMPLICITLY.
87 87
              *
88 88
              * USERS IN THIS ROLE DO NOT HAVE TO BE IDENTIFIED TO GET THE RIGHTS CONFERRED HERE.
89 89
              * DO NOT ADD ANY SECURITY-SENSITIVE RIGHTS HERE.
90 90
              */
91
-            '_childRoles'   => array(
92
-                'publicStats',
93
-            ),
94
-            PageTeam::class => array(
95
-                self::MAIN => self::ACCESS_ALLOW,
96
-            ),
97
-            PageXffDemo::class        => array(
98
-                self::MAIN  => self::ACCESS_ALLOW,
99
-            )
100
-        ),
101
-        'loggedIn'          => array(
102
-            /*
91
+			'_childRoles'   => array(
92
+				'publicStats',
93
+			),
94
+			PageTeam::class => array(
95
+				self::MAIN => self::ACCESS_ALLOW,
96
+			),
97
+			PageXffDemo::class        => array(
98
+				self::MAIN  => self::ACCESS_ALLOW,
99
+			)
100
+		),
101
+		'loggedIn'          => array(
102
+			/*
103 103
              * THIS ROLE IS GRANTED TO ALL LOGGED IN USERS IMPLICITLY.
104 104
              *
105 105
              * USERS IN THIS ROLE DO NOT HAVE TO BE IDENTIFIED TO GET THE RIGHTS CONFERRED HERE.
106 106
              * DO NOT ADD ANY SECURITY-SENSITIVE RIGHTS HERE.
107 107
              */
108
-            '_childRoles'             => array(
109
-                'public',
110
-            ),
111
-            PagePreferences::class    => array(
112
-                self::MAIN => self::ACCESS_ALLOW,
113
-                'refreshOAuth' => self::ACCESS_ALLOW,
114
-            ),
115
-            PageChangePassword::class => array(
116
-                self::MAIN => self::ACCESS_ALLOW,
117
-            ),
118
-            PageMultiFactor::class    => array(
119
-                self::MAIN          => self::ACCESS_ALLOW,
120
-                'scratch'           => self::ACCESS_ALLOW,
121
-                'enableYubikeyOtp'  => self::ACCESS_ALLOW,
122
-                'disableYubikeyOtp' => self::ACCESS_ALLOW,
123
-                'enableTotp'        => self::ACCESS_ALLOW,
124
-                'disableTotp'       => self::ACCESS_ALLOW,
125
-            ),
126
-            PageOAuth::class          => array(
127
-                'attach' => self::ACCESS_ALLOW,
128
-                'detach' => self::ACCESS_ALLOW,
129
-            ),
130
-        ),
131
-        'user'              => array(
132
-            '_description'                       => 'A standard tool user.',
133
-            '_editableBy'                        => array('admin', 'toolRoot'),
134
-            '_childRoles'                        => array(
135
-                'internalStats',
136
-            ),
137
-            PageMain::class                      => array(
138
-                self::MAIN => self::ACCESS_ALLOW,
139
-            ),
140
-            PageBan::class                       => array(
141
-                self::MAIN => self::ACCESS_ALLOW,
142
-            ),
143
-            PageEditComment::class               => array(
144
-                self::MAIN => self::ACCESS_ALLOW,
145
-            ),
146
-            PageEmailManagement::class           => array(
147
-                self::MAIN => self::ACCESS_ALLOW,
148
-                'view'     => self::ACCESS_ALLOW,
149
-            ),
150
-            PageExpandedRequestList::class       => array(
151
-                self::MAIN => self::ACCESS_ALLOW,
152
-            ),
153
-            PageLog::class                       => array(
154
-                self::MAIN => self::ACCESS_ALLOW,
155
-            ),
156
-            PageSearch::class                    => array(
157
-                self::MAIN => self::ACCESS_ALLOW,
158
-            ),
159
-            PageWelcomeTemplateManagement::class => array(
160
-                self::MAIN => self::ACCESS_ALLOW,
161
-                'select'   => self::ACCESS_ALLOW,
162
-                'view'     => self::ACCESS_ALLOW,
163
-            ),
164
-            PageViewRequest::class               => array(
165
-                self::MAIN       => self::ACCESS_ALLOW,
166
-                'seeAllRequests' => self::ACCESS_ALLOW,
167
-            ),
168
-            'RequestData'                        => array(
169
-                'seePrivateDataWhenReserved' => self::ACCESS_ALLOW,
170
-                'seePrivateDataWithHash'     => self::ACCESS_ALLOW,
171
-            ),
172
-            PageCustomClose::class               => array(
173
-                self::MAIN => self::ACCESS_ALLOW,
174
-            ),
175
-            PageComment::class                   => array(
176
-                self::MAIN => self::ACCESS_ALLOW,
177
-            ),
178
-            PageCloseRequest::class              => array(
179
-                self::MAIN => self::ACCESS_ALLOW,
180
-            ),
181
-            PageCreateRequest::class             => array(
182
-                self::MAIN => self::ACCESS_ALLOW,
183
-            ),
184
-            PageDeferRequest::class              => array(
185
-                self::MAIN => self::ACCESS_ALLOW,
186
-            ),
187
-            PageDropRequest::class               => array(
188
-                self::MAIN => self::ACCESS_ALLOW,
189
-            ),
190
-            PageReservation::class               => array(
191
-                self::MAIN => self::ACCESS_ALLOW,
192
-            ),
193
-            PageSendToUser::class                => array(
194
-                self::MAIN => self::ACCESS_ALLOW,
195
-            ),
196
-            PageBreakReservation::class          => array(
197
-                self::MAIN => self::ACCESS_ALLOW,
198
-            ),
199
-            PageJobQueue::class                  => array(
200
-                self::MAIN => self::ACCESS_ALLOW,
201
-                'view'     => self::ACCESS_ALLOW,
202
-                'all'      => self::ACCESS_ALLOW,
203
-            ),
204
-            'RequestCreation'                    => array(
205
-                User::CREATION_MANUAL => self::ACCESS_ALLOW,
206
-            ),
207
-            'GlobalInfo'                         => array(
208
-                'viewSiteNotice' => self::ACCESS_ALLOW,
209
-                'viewOnlineUsers' => self::ACCESS_ALLOW,
210
-            ),
211
-        ),
212
-        'admin'             => array(
213
-            '_description'                       => 'A tool administrator.',
214
-            '_editableBy'                        => array('admin', 'toolRoot'),
215
-            '_childRoles'                        => array(
216
-                'user',
217
-                'requestAdminTools',
218
-            ),
219
-            PageEmailManagement::class           => array(
220
-                'edit'   => self::ACCESS_ALLOW,
221
-                'create' => self::ACCESS_ALLOW,
222
-            ),
223
-            PageSiteNotice::class                => array(
224
-                self::MAIN => self::ACCESS_ALLOW,
225
-            ),
226
-            PageUserManagement::class            => array(
227
-                self::MAIN  => self::ACCESS_ALLOW,
228
-                'approve'   => self::ACCESS_ALLOW,
229
-                'decline'   => self::ACCESS_ALLOW,
230
-                'rename'    => self::ACCESS_ALLOW,
231
-                'editUser'  => self::ACCESS_ALLOW,
232
-                'suspend'   => self::ACCESS_ALLOW,
233
-                'editRoles' => self::ACCESS_ALLOW,
234
-            ),
235
-            PageWelcomeTemplateManagement::class => array(
236
-                'edit'   => self::ACCESS_ALLOW,
237
-                'delete' => self::ACCESS_ALLOW,
238
-                'add'    => self::ACCESS_ALLOW,
239
-            ),
240
-            PageJobQueue::class                  => array(
241
-                'acknowledge' => self::ACCESS_ALLOW,
242
-                'requeue'     => self::ACCESS_ALLOW,
243
-            ),
244
-        ),
245
-        'checkuser'         => array(
246
-            '_description'            => 'A user with CheckUser access',
247
-            '_editableBy'             => array('checkuser', 'toolRoot'),
248
-            '_childRoles'             => array(
249
-                'user',
250
-                'requestAdminTools',
251
-            ),
252
-            PageUserManagement::class => array(
253
-                self::MAIN  => self::ACCESS_ALLOW,
254
-                'suspend'   => self::ACCESS_ALLOW,
255
-                'editRoles' => self::ACCESS_ALLOW,
256
-            ),
257
-            'RequestData'             => array(
258
-                'seeUserAgentData' => self::ACCESS_ALLOW,
259
-            ),
260
-        ),
261
-        'toolRoot'          => array(
262
-            '_description' => 'A user with shell access to the servers running the tool',
263
-            '_editableBy'  => array('toolRoot'),
264
-            '_childRoles'  => array(
265
-                'admin',
266
-            ),
267
-            PageMultiFactor::class => array(
268
-                'enableU2F'         => self::ACCESS_ALLOW,
269
-                'disableU2F'        => self::ACCESS_ALLOW,
270
-            )
271
-        ),
272
-        'botCreation'       => array(
273
-            '_description'    => 'A user allowed to use the bot to perform account creations',
274
-            '_editableBy'     => array('admin', 'toolRoot'),
275
-            '_childRoles'     => array(),
276
-            'RequestCreation' => array(
277
-                User::CREATION_BOT => self::ACCESS_ALLOW,
278
-            ),
279
-        ),
280
-        'oauthCreation'       => array(
281
-            '_description'    => 'A user allowed to use the OAuth to perform account creations',
282
-            '_editableBy'     => array('admin', 'toolRoot'),
283
-            '_childRoles'     => array(),
284
-            'RequestCreation'                    => array(
285
-                User::CREATION_OAUTH  => self::ACCESS_ALLOW,
286
-            ),
287
-        ),
108
+			'_childRoles'             => array(
109
+				'public',
110
+			),
111
+			PagePreferences::class    => array(
112
+				self::MAIN => self::ACCESS_ALLOW,
113
+				'refreshOAuth' => self::ACCESS_ALLOW,
114
+			),
115
+			PageChangePassword::class => array(
116
+				self::MAIN => self::ACCESS_ALLOW,
117
+			),
118
+			PageMultiFactor::class    => array(
119
+				self::MAIN          => self::ACCESS_ALLOW,
120
+				'scratch'           => self::ACCESS_ALLOW,
121
+				'enableYubikeyOtp'  => self::ACCESS_ALLOW,
122
+				'disableYubikeyOtp' => self::ACCESS_ALLOW,
123
+				'enableTotp'        => self::ACCESS_ALLOW,
124
+				'disableTotp'       => self::ACCESS_ALLOW,
125
+			),
126
+			PageOAuth::class          => array(
127
+				'attach' => self::ACCESS_ALLOW,
128
+				'detach' => self::ACCESS_ALLOW,
129
+			),
130
+		),
131
+		'user'              => array(
132
+			'_description'                       => 'A standard tool user.',
133
+			'_editableBy'                        => array('admin', 'toolRoot'),
134
+			'_childRoles'                        => array(
135
+				'internalStats',
136
+			),
137
+			PageMain::class                      => array(
138
+				self::MAIN => self::ACCESS_ALLOW,
139
+			),
140
+			PageBan::class                       => array(
141
+				self::MAIN => self::ACCESS_ALLOW,
142
+			),
143
+			PageEditComment::class               => array(
144
+				self::MAIN => self::ACCESS_ALLOW,
145
+			),
146
+			PageEmailManagement::class           => array(
147
+				self::MAIN => self::ACCESS_ALLOW,
148
+				'view'     => self::ACCESS_ALLOW,
149
+			),
150
+			PageExpandedRequestList::class       => array(
151
+				self::MAIN => self::ACCESS_ALLOW,
152
+			),
153
+			PageLog::class                       => array(
154
+				self::MAIN => self::ACCESS_ALLOW,
155
+			),
156
+			PageSearch::class                    => array(
157
+				self::MAIN => self::ACCESS_ALLOW,
158
+			),
159
+			PageWelcomeTemplateManagement::class => array(
160
+				self::MAIN => self::ACCESS_ALLOW,
161
+				'select'   => self::ACCESS_ALLOW,
162
+				'view'     => self::ACCESS_ALLOW,
163
+			),
164
+			PageViewRequest::class               => array(
165
+				self::MAIN       => self::ACCESS_ALLOW,
166
+				'seeAllRequests' => self::ACCESS_ALLOW,
167
+			),
168
+			'RequestData'                        => array(
169
+				'seePrivateDataWhenReserved' => self::ACCESS_ALLOW,
170
+				'seePrivateDataWithHash'     => self::ACCESS_ALLOW,
171
+			),
172
+			PageCustomClose::class               => array(
173
+				self::MAIN => self::ACCESS_ALLOW,
174
+			),
175
+			PageComment::class                   => array(
176
+				self::MAIN => self::ACCESS_ALLOW,
177
+			),
178
+			PageCloseRequest::class              => array(
179
+				self::MAIN => self::ACCESS_ALLOW,
180
+			),
181
+			PageCreateRequest::class             => array(
182
+				self::MAIN => self::ACCESS_ALLOW,
183
+			),
184
+			PageDeferRequest::class              => array(
185
+				self::MAIN => self::ACCESS_ALLOW,
186
+			),
187
+			PageDropRequest::class               => array(
188
+				self::MAIN => self::ACCESS_ALLOW,
189
+			),
190
+			PageReservation::class               => array(
191
+				self::MAIN => self::ACCESS_ALLOW,
192
+			),
193
+			PageSendToUser::class                => array(
194
+				self::MAIN => self::ACCESS_ALLOW,
195
+			),
196
+			PageBreakReservation::class          => array(
197
+				self::MAIN => self::ACCESS_ALLOW,
198
+			),
199
+			PageJobQueue::class                  => array(
200
+				self::MAIN => self::ACCESS_ALLOW,
201
+				'view'     => self::ACCESS_ALLOW,
202
+				'all'      => self::ACCESS_ALLOW,
203
+			),
204
+			'RequestCreation'                    => array(
205
+				User::CREATION_MANUAL => self::ACCESS_ALLOW,
206
+			),
207
+			'GlobalInfo'                         => array(
208
+				'viewSiteNotice' => self::ACCESS_ALLOW,
209
+				'viewOnlineUsers' => self::ACCESS_ALLOW,
210
+			),
211
+		),
212
+		'admin'             => array(
213
+			'_description'                       => 'A tool administrator.',
214
+			'_editableBy'                        => array('admin', 'toolRoot'),
215
+			'_childRoles'                        => array(
216
+				'user',
217
+				'requestAdminTools',
218
+			),
219
+			PageEmailManagement::class           => array(
220
+				'edit'   => self::ACCESS_ALLOW,
221
+				'create' => self::ACCESS_ALLOW,
222
+			),
223
+			PageSiteNotice::class                => array(
224
+				self::MAIN => self::ACCESS_ALLOW,
225
+			),
226
+			PageUserManagement::class            => array(
227
+				self::MAIN  => self::ACCESS_ALLOW,
228
+				'approve'   => self::ACCESS_ALLOW,
229
+				'decline'   => self::ACCESS_ALLOW,
230
+				'rename'    => self::ACCESS_ALLOW,
231
+				'editUser'  => self::ACCESS_ALLOW,
232
+				'suspend'   => self::ACCESS_ALLOW,
233
+				'editRoles' => self::ACCESS_ALLOW,
234
+			),
235
+			PageWelcomeTemplateManagement::class => array(
236
+				'edit'   => self::ACCESS_ALLOW,
237
+				'delete' => self::ACCESS_ALLOW,
238
+				'add'    => self::ACCESS_ALLOW,
239
+			),
240
+			PageJobQueue::class                  => array(
241
+				'acknowledge' => self::ACCESS_ALLOW,
242
+				'requeue'     => self::ACCESS_ALLOW,
243
+			),
244
+		),
245
+		'checkuser'         => array(
246
+			'_description'            => 'A user with CheckUser access',
247
+			'_editableBy'             => array('checkuser', 'toolRoot'),
248
+			'_childRoles'             => array(
249
+				'user',
250
+				'requestAdminTools',
251
+			),
252
+			PageUserManagement::class => array(
253
+				self::MAIN  => self::ACCESS_ALLOW,
254
+				'suspend'   => self::ACCESS_ALLOW,
255
+				'editRoles' => self::ACCESS_ALLOW,
256
+			),
257
+			'RequestData'             => array(
258
+				'seeUserAgentData' => self::ACCESS_ALLOW,
259
+			),
260
+		),
261
+		'toolRoot'          => array(
262
+			'_description' => 'A user with shell access to the servers running the tool',
263
+			'_editableBy'  => array('toolRoot'),
264
+			'_childRoles'  => array(
265
+				'admin',
266
+			),
267
+			PageMultiFactor::class => array(
268
+				'enableU2F'         => self::ACCESS_ALLOW,
269
+				'disableU2F'        => self::ACCESS_ALLOW,
270
+			)
271
+		),
272
+		'botCreation'       => array(
273
+			'_description'    => 'A user allowed to use the bot to perform account creations',
274
+			'_editableBy'     => array('admin', 'toolRoot'),
275
+			'_childRoles'     => array(),
276
+			'RequestCreation' => array(
277
+				User::CREATION_BOT => self::ACCESS_ALLOW,
278
+			),
279
+		),
280
+		'oauthCreation'       => array(
281
+			'_description'    => 'A user allowed to use the OAuth to perform account creations',
282
+			'_editableBy'     => array('admin', 'toolRoot'),
283
+			'_childRoles'     => array(),
284
+			'RequestCreation'                    => array(
285
+				User::CREATION_OAUTH  => self::ACCESS_ALLOW,
286
+			),
287
+		),
288 288
 
289 289
 
290
-        // Child roles go below this point
291
-        'publicStats'       => array(
292
-            '_hidden'               => true,
293
-            StatsUsers::class       => array(
294
-                self::MAIN => self::ACCESS_ALLOW,
295
-                'detail'   => self::ACCESS_ALLOW,
296
-            ),
297
-            StatsTopCreators::class => array(
298
-                self::MAIN => self::ACCESS_ALLOW,
299
-            ),
300
-        ),
301
-        'internalStats'     => array(
302
-            '_hidden'                    => true,
303
-            StatsMain::class             => array(
304
-                self::MAIN => self::ACCESS_ALLOW,
305
-            ),
306
-            StatsFastCloses::class       => array(
307
-                self::MAIN => self::ACCESS_ALLOW,
308
-            ),
309
-            StatsInactiveUsers::class    => array(
310
-                self::MAIN => self::ACCESS_ALLOW,
311
-            ),
312
-            StatsMonthlyStats::class     => array(
313
-                self::MAIN => self::ACCESS_ALLOW,
314
-            ),
315
-            StatsReservedRequests::class => array(
316
-                self::MAIN => self::ACCESS_ALLOW,
317
-            ),
318
-            StatsTemplateStats::class    => array(
319
-                self::MAIN => self::ACCESS_ALLOW,
320
-            ),
321
-        ),
322
-        'requestAdminTools' => array(
323
-            '_hidden'                   => true,
324
-            PageBan::class              => array(
325
-                self::MAIN => self::ACCESS_ALLOW,
326
-                'set'      => self::ACCESS_ALLOW,
327
-                'remove'   => self::ACCESS_ALLOW,
328
-            ),
329
-            PageEditComment::class      => array(
330
-                'editOthers' => self::ACCESS_ALLOW,
331
-            ),
332
-            PageBreakReservation::class => array(
333
-                'force' => self::ACCESS_ALLOW,
334
-            ),
335
-            PageCustomClose::class      => array(
336
-                'skipCcMailingList' => self::ACCESS_ALLOW,
337
-            ),
338
-            'RequestData'               => array(
339
-                'reopenOldRequest'      => self::ACCESS_ALLOW,
340
-                'alwaysSeePrivateData'  => self::ACCESS_ALLOW,
341
-                'alwaysSeeHash'         => self::ACCESS_ALLOW,
342
-                'seeRestrictedComments' => self::ACCESS_ALLOW,
343
-            ),
344
-        ),
345
-    );
346
-    /** @var array
347
-     * List of roles which are *exempt* from the identification requirements
348
-     *
349
-     * Think twice about adding roles to this list.
350
-     *
351
-     * @category Security-Critical
352
-     */
353
-    private $identificationExempt = array('public', 'loggedIn');
290
+		// Child roles go below this point
291
+		'publicStats'       => array(
292
+			'_hidden'               => true,
293
+			StatsUsers::class       => array(
294
+				self::MAIN => self::ACCESS_ALLOW,
295
+				'detail'   => self::ACCESS_ALLOW,
296
+			),
297
+			StatsTopCreators::class => array(
298
+				self::MAIN => self::ACCESS_ALLOW,
299
+			),
300
+		),
301
+		'internalStats'     => array(
302
+			'_hidden'                    => true,
303
+			StatsMain::class             => array(
304
+				self::MAIN => self::ACCESS_ALLOW,
305
+			),
306
+			StatsFastCloses::class       => array(
307
+				self::MAIN => self::ACCESS_ALLOW,
308
+			),
309
+			StatsInactiveUsers::class    => array(
310
+				self::MAIN => self::ACCESS_ALLOW,
311
+			),
312
+			StatsMonthlyStats::class     => array(
313
+				self::MAIN => self::ACCESS_ALLOW,
314
+			),
315
+			StatsReservedRequests::class => array(
316
+				self::MAIN => self::ACCESS_ALLOW,
317
+			),
318
+			StatsTemplateStats::class    => array(
319
+				self::MAIN => self::ACCESS_ALLOW,
320
+			),
321
+		),
322
+		'requestAdminTools' => array(
323
+			'_hidden'                   => true,
324
+			PageBan::class              => array(
325
+				self::MAIN => self::ACCESS_ALLOW,
326
+				'set'      => self::ACCESS_ALLOW,
327
+				'remove'   => self::ACCESS_ALLOW,
328
+			),
329
+			PageEditComment::class      => array(
330
+				'editOthers' => self::ACCESS_ALLOW,
331
+			),
332
+			PageBreakReservation::class => array(
333
+				'force' => self::ACCESS_ALLOW,
334
+			),
335
+			PageCustomClose::class      => array(
336
+				'skipCcMailingList' => self::ACCESS_ALLOW,
337
+			),
338
+			'RequestData'               => array(
339
+				'reopenOldRequest'      => self::ACCESS_ALLOW,
340
+				'alwaysSeePrivateData'  => self::ACCESS_ALLOW,
341
+				'alwaysSeeHash'         => self::ACCESS_ALLOW,
342
+				'seeRestrictedComments' => self::ACCESS_ALLOW,
343
+			),
344
+		),
345
+	);
346
+	/** @var array
347
+	 * List of roles which are *exempt* from the identification requirements
348
+	 *
349
+	 * Think twice about adding roles to this list.
350
+	 *
351
+	 * @category Security-Critical
352
+	 */
353
+	private $identificationExempt = array('public', 'loggedIn');
354 354
 
355
-    /**
356
-     * RoleConfiguration constructor.
357
-     *
358
-     * @param array $roleConfig           Set to non-null to override the default configuration.
359
-     * @param array $identificationExempt Set to non-null to override the default configuration.
360
-     */
361
-    public function __construct(array $roleConfig = null, array $identificationExempt = null)
362
-    {
363
-        if ($roleConfig !== null) {
364
-            $this->roleConfig = $roleConfig;
365
-        }
355
+	/**
356
+	 * RoleConfiguration constructor.
357
+	 *
358
+	 * @param array $roleConfig           Set to non-null to override the default configuration.
359
+	 * @param array $identificationExempt Set to non-null to override the default configuration.
360
+	 */
361
+	public function __construct(array $roleConfig = null, array $identificationExempt = null)
362
+	{
363
+		if ($roleConfig !== null) {
364
+			$this->roleConfig = $roleConfig;
365
+		}
366 366
 
367
-        if ($identificationExempt !== null) {
368
-            $this->identificationExempt = $identificationExempt;
369
-        }
370
-    }
367
+		if ($identificationExempt !== null) {
368
+			$this->identificationExempt = $identificationExempt;
369
+		}
370
+	}
371 371
 
372
-    /**
373
-     * @param array $roles The roles to check
374
-     *
375
-     * @return array
376
-     */
377
-    public function getApplicableRoles(array $roles)
378
-    {
379
-        $available = array();
372
+	/**
373
+	 * @param array $roles The roles to check
374
+	 *
375
+	 * @return array
376
+	 */
377
+	public function getApplicableRoles(array $roles)
378
+	{
379
+		$available = array();
380 380
 
381
-        foreach ($roles as $role) {
382
-            if (!isset($this->roleConfig[$role])) {
383
-                // wat
384
-                continue;
385
-            }
381
+		foreach ($roles as $role) {
382
+			if (!isset($this->roleConfig[$role])) {
383
+				// wat
384
+				continue;
385
+			}
386 386
 
387
-            $available[$role] = $this->roleConfig[$role];
387
+			$available[$role] = $this->roleConfig[$role];
388 388
 
389
-            if (isset($available[$role]['_childRoles'])) {
390
-                $childRoles = $this->getApplicableRoles($available[$role]['_childRoles']);
391
-                $available = array_merge($available, $childRoles);
389
+			if (isset($available[$role]['_childRoles'])) {
390
+				$childRoles = $this->getApplicableRoles($available[$role]['_childRoles']);
391
+				$available = array_merge($available, $childRoles);
392 392
 
393
-                unset($available[$role]['_childRoles']);
394
-            }
393
+				unset($available[$role]['_childRoles']);
394
+			}
395 395
 
396
-            foreach (array('_hidden', '_editableBy', '_description') as $item) {
397
-                if (isset($available[$role][$item])) {
398
-                    unset($available[$role][$item]);
399
-                }
400
-            }
401
-        }
396
+			foreach (array('_hidden', '_editableBy', '_description') as $item) {
397
+				if (isset($available[$role][$item])) {
398
+					unset($available[$role][$item]);
399
+				}
400
+			}
401
+		}
402 402
 
403
-        return $available;
404
-    }
403
+		return $available;
404
+	}
405 405
 
406
-    public function getAvailableRoles()
407
-    {
408
-        $possible = array_diff(array_keys($this->roleConfig), array('public', 'loggedIn'));
406
+	public function getAvailableRoles()
407
+	{
408
+		$possible = array_diff(array_keys($this->roleConfig), array('public', 'loggedIn'));
409 409
 
410
-        $actual = array();
410
+		$actual = array();
411 411
 
412
-        foreach ($possible as $role) {
413
-            if (!isset($this->roleConfig[$role]['_hidden'])) {
414
-                $actual[$role] = array(
415
-                    'description' => $this->roleConfig[$role]['_description'],
416
-                    'editableBy'  => $this->roleConfig[$role]['_editableBy'],
417
-                );
418
-            }
419
-        }
412
+		foreach ($possible as $role) {
413
+			if (!isset($this->roleConfig[$role]['_hidden'])) {
414
+				$actual[$role] = array(
415
+					'description' => $this->roleConfig[$role]['_description'],
416
+					'editableBy'  => $this->roleConfig[$role]['_editableBy'],
417
+				);
418
+			}
419
+		}
420 420
 
421
-        return $actual;
422
-    }
421
+		return $actual;
422
+	}
423 423
 
424
-    /**
425
-     * @param string $role
426
-     *
427
-     * @return bool
428
-     */
429
-    public function roleNeedsIdentification($role)
430
-    {
431
-        if (in_array($role, $this->identificationExempt)) {
432
-            return false;
433
-        }
424
+	/**
425
+	 * @param string $role
426
+	 *
427
+	 * @return bool
428
+	 */
429
+	public function roleNeedsIdentification($role)
430
+	{
431
+		if (in_array($role, $this->identificationExempt)) {
432
+			return false;
433
+		}
434 434
 
435
-        return true;
436
-    }
435
+		return true;
436
+	}
437 437
 }
Please login to merge, or discard this patch.
includes/Offline.php 1 patch
Indentation   +37 added lines, -37 removed lines patch added patch discarded remove patch
@@ -17,16 +17,16 @@  discard block
 block discarded – undo
17 17
  */
18 18
 class Offline
19 19
 {
20
-    /**
21
-     * Determines if the tool is offline
22
-     * @return bool
23
-     */
24
-    public static function isOffline()
25
-    {
26
-        global $dontUseDb;
20
+	/**
21
+	 * Determines if the tool is offline
22
+	 * @return bool
23
+	 */
24
+	public static function isOffline()
25
+	{
26
+		global $dontUseDb;
27 27
 
28
-        return (bool)$dontUseDb;
29
-    }
28
+		return (bool)$dontUseDb;
29
+	}
30 30
 
31 31
 	/**
32 32
 	 * Gets the offline message
@@ -37,38 +37,38 @@  discard block
 block discarded – undo
37 37
 	 * @return string
38 38
 	 * @throws SmartyException
39 39
 	 */
40
-    public static function getOfflineMessage($external, $message = null)
41
-    {
42
-        global $dontUseDbCulprit, $dontUseDbReason, $baseurl;
40
+	public static function getOfflineMessage($external, $message = null)
41
+	{
42
+		global $dontUseDbCulprit, $dontUseDbReason, $baseurl;
43 43
 
44
-        $smarty = new Smarty();
45
-        $smarty->assign("baseurl", $baseurl);
46
-        $smarty->assign("alerts", []);
47
-        $smarty->assign("toolversion", Environment::getToolVersion());
44
+		$smarty = new Smarty();
45
+		$smarty->assign("baseurl", $baseurl);
46
+		$smarty->assign("alerts", []);
47
+		$smarty->assign("toolversion", Environment::getToolVersion());
48 48
 
49
-        if (!headers_sent()) {
50
-            header("HTTP/1.1 503 Service Unavailable");
51
-        }
49
+		if (!headers_sent()) {
50
+			header("HTTP/1.1 503 Service Unavailable");
51
+		}
52 52
 
53
-        if ($external) {
54
-            return $smarty->fetch("offline/external.tpl");
55
-        }
56
-        else {
57
-            $hideCulprit = true;
53
+		if ($external) {
54
+			return $smarty->fetch("offline/external.tpl");
55
+		}
56
+		else {
57
+			$hideCulprit = true;
58 58
 
59
-            // Use the provided message if possible
60
-            if ($message === null) {
61
-                $hideCulprit = false;
62
-                $message = $dontUseDbReason;
63
-            }
59
+			// Use the provided message if possible
60
+			if ($message === null) {
61
+				$hideCulprit = false;
62
+				$message = $dontUseDbReason;
63
+			}
64 64
 
65
-            $smarty->assign("hideCulprit", $hideCulprit);
66
-            $smarty->assign("dontUseDbCulprit", $dontUseDbCulprit);
67
-            $smarty->assign("dontUseDbReason", $message);
68
-            $smarty->assign("alerts", array());
69
-            $smarty->assign('currentUser', User::getCommunity());
65
+			$smarty->assign("hideCulprit", $hideCulprit);
66
+			$smarty->assign("dontUseDbCulprit", $dontUseDbCulprit);
67
+			$smarty->assign("dontUseDbReason", $message);
68
+			$smarty->assign("alerts", array());
69
+			$smarty->assign('currentUser', User::getCommunity());
70 70
 
71
-            return $smarty->fetch("offline/internal.tpl");
72
-        }
73
-    }
71
+			return $smarty->fetch("offline/internal.tpl");
72
+		}
73
+	}
74 74
 }
Please login to merge, or discard this patch.