27
27
import org .junit .Assert ;
28
28
import org .junit .BeforeClass ;
29
29
import org .junit .Test ;
30
- import org .opensolaris .opengrok .authorization .AuthorizationCheck .AuthorizationRole ;
30
+ import org .opensolaris .opengrok .authorization .AuthorizationCheck .AuthControlFlag ;
31
31
import org .opensolaris .opengrok .configuration .Group ;
32
32
import org .opensolaris .opengrok .configuration .Project ;
33
33
import org .opensolaris .opengrok .configuration .RuntimeEnvironment ;
@@ -53,8 +53,8 @@ public void test2Plugins() {
53
53
@ Test
54
54
public void testRolePlugins () {
55
55
AuthorizationFramework instance = getInstance ();
56
- instance .addPlugin (createNotAllowedPrefixPlugin (), AuthorizationRole .SUFFICIENT );
57
- instance .addPlugin (createAllowedPrefixPlugin (), AuthorizationRole .REQUIRED );
56
+ instance .addPlugin (createNotAllowedPrefixPlugin (), AuthControlFlag .SUFFICIENT );
57
+ instance .addPlugin (createAllowedPrefixPlugin (), AuthControlFlag .REQUIRED );
58
58
59
59
// sufficient is ok
60
60
Assert .assertTrue (instance .isAllowed (createRequest (), createUnallowedProject ()));
@@ -67,8 +67,8 @@ public void testRolePlugins() {
67
67
@ Test
68
68
public void testRolePlugins1 () {
69
69
AuthorizationFramework instance = getInstance ();
70
- instance .addPlugin (createAllowedPrefixPlugin (), AuthorizationRole .SUFFICIENT );
71
- instance .addPlugin (createNotAllowedPrefixPlugin (), AuthorizationRole .REQUIRED );
70
+ instance .addPlugin (createAllowedPrefixPlugin (), AuthControlFlag .SUFFICIENT );
71
+ instance .addPlugin (createNotAllowedPrefixPlugin (), AuthControlFlag .REQUIRED );
72
72
73
73
// sufficient fails and required is ok
74
74
Assert .assertTrue (instance .isAllowed (createRequest (), createUnallowedProject ()));
@@ -81,8 +81,8 @@ public void testRolePlugins1() {
81
81
@ Test
82
82
public void testRolePlugin2 () {
83
83
AuthorizationFramework instance = getInstance ();
84
- instance .addPlugin (createNotAllowedPrefixPlugin (), AuthorizationRole .SUFFICIENT );
85
- instance .addPlugin (createAllowedPrefixPlugin (), AuthorizationRole .SUFFICIENT );
84
+ instance .addPlugin (createNotAllowedPrefixPlugin (), AuthControlFlag .SUFFICIENT );
85
+ instance .addPlugin (createAllowedPrefixPlugin (), AuthControlFlag .SUFFICIENT );
86
86
87
87
// all are sufficient - success
88
88
Assert .assertTrue (instance .isAllowed (createRequest (), createUnallowedProject ()));
@@ -94,8 +94,8 @@ public void testRolePlugin2() {
94
94
@ Test
95
95
public void testRolePlugin3 () {
96
96
AuthorizationFramework instance = getInstance ();
97
- instance .addPlugin (createNotAllowedPrefixPlugin (), AuthorizationRole .REQUIRED );
98
- instance .addPlugin (createAllowedPrefixPlugin (), AuthorizationRole .SUFFICIENT );
97
+ instance .addPlugin (createNotAllowedPrefixPlugin (), AuthControlFlag .REQUIRED );
98
+ instance .addPlugin (createAllowedPrefixPlugin (), AuthControlFlag .SUFFICIENT );
99
99
100
100
// required fails
101
101
Assert .assertFalse (instance .isAllowed (createRequest (), createAllowedProject ()));
@@ -108,8 +108,8 @@ public void testRolePlugin3() {
108
108
@ Test
109
109
public void testRolePlugin4 () {
110
110
AuthorizationFramework instance = getInstance ();
111
- instance .addPlugin (createAllowedPrefixPlugin (), AuthorizationRole .SUFFICIENT );
112
- instance .addPlugin (createAllowedPrefixPlugin (), AuthorizationRole .REQUIRED );
111
+ instance .addPlugin (createAllowedPrefixPlugin (), AuthControlFlag .SUFFICIENT );
112
+ instance .addPlugin (createAllowedPrefixPlugin (), AuthControlFlag .REQUIRED );
113
113
114
114
// same instance is not added twice in the plugins so
115
115
// there is only one plugin set as sufficient thus everything is true
@@ -122,8 +122,8 @@ public void testRolePlugin4() {
122
122
@ Test
123
123
public void testRolePlugin5 () {
124
124
AuthorizationFramework instance = getInstance ();
125
- instance .addPlugin (createAllowedPrefixPlugin (), AuthorizationRole .REQUIRED );
126
- instance .addPlugin (createAllowedPrefixPlugin (), AuthorizationRole .REQUIRED );
125
+ instance .addPlugin (createAllowedPrefixPlugin (), AuthControlFlag .REQUIRED );
126
+ instance .addPlugin (createAllowedPrefixPlugin (), AuthControlFlag .REQUIRED );
127
127
128
128
// same instance is not added twice in the plugins so
129
129
// there is only one plugin set as required
@@ -137,8 +137,8 @@ public void testRolePlugin5() {
137
137
@ Test
138
138
public void testRolePlugin6 () {
139
139
AuthorizationFramework instance = getInstance ();
140
- instance .addPlugin (createAllowedPrefixPlugin (), AuthorizationRole .REQUISITE );
141
- instance .addPlugin (createNotAllowedPrefixPlugin (), AuthorizationRole .SUFFICIENT );
140
+ instance .addPlugin (createAllowedPrefixPlugin (), AuthControlFlag .REQUISITE );
141
+ instance .addPlugin (createNotAllowedPrefixPlugin (), AuthControlFlag .SUFFICIENT );
142
142
143
143
// requisite is ok and the other plugin is sufficient
144
144
Assert .assertTrue (instance .isAllowed (createRequest (), createAllowedProject ()));
@@ -151,8 +151,8 @@ public void testRolePlugin6() {
151
151
@ Test
152
152
public void testRolePlugin7 () {
153
153
AuthorizationFramework instance = getInstance ();
154
- instance .addPlugin (createAllowedPrefixPlugin (), AuthorizationRole .REQUISITE );
155
- instance .addPlugin (createNotAllowedPrefixPlugin (), AuthorizationRole .REQUIRED );
154
+ instance .addPlugin (createAllowedPrefixPlugin (), AuthControlFlag .REQUISITE );
155
+ instance .addPlugin (createNotAllowedPrefixPlugin (), AuthControlFlag .REQUIRED );
156
156
157
157
// requisite is ok however required fails
158
158
Assert .assertFalse (instance .isAllowed (createRequest (), createAllowedProject ()));
@@ -164,8 +164,8 @@ public void testRolePlugin7() {
164
164
@ Test
165
165
public void testRolePlugin8 () {
166
166
AuthorizationFramework instance = getInstance ();
167
- instance .addPlugin (createNotAllowedPrefixPlugin (), AuthorizationRole .REQUISITE );
168
- instance .addPlugin (createAllowedPrefixPlugin (), AuthorizationRole .REQUIRED );
167
+ instance .addPlugin (createNotAllowedPrefixPlugin (), AuthControlFlag .REQUISITE );
168
+ instance .addPlugin (createAllowedPrefixPlugin (), AuthControlFlag .REQUIRED );
169
169
170
170
// requisite fails
171
171
Assert .assertFalse (instance .isAllowed (createRequest (), createAllowedProject ()));
@@ -178,8 +178,8 @@ public void testRolePlugin8() {
178
178
@ Test
179
179
public void testRolePlugins9 () {
180
180
AuthorizationFramework instance = getInstance ();
181
- instance .addPlugin (createLoadFailingPlugin (), AuthorizationRole .SUFFICIENT );
182
- instance .addPlugin (createAllowedPrefixPlugin (), AuthorizationRole .REQUIRED );
181
+ instance .addPlugin (createLoadFailingPlugin (), AuthControlFlag .SUFFICIENT );
182
+ instance .addPlugin (createAllowedPrefixPlugin (), AuthControlFlag .REQUIRED );
183
183
instance .loadAllPlugins ();
184
184
185
185
// sufficient fails and required fails as well
@@ -193,8 +193,8 @@ public void testRolePlugins9() {
193
193
@ Test
194
194
public void testRolePlugin10 () {
195
195
AuthorizationFramework instance = getInstance ();
196
- instance .addPlugin (createLoadFailingPlugin (), AuthorizationRole .SUFFICIENT );
197
- instance .addPlugin (createAllowedPrefixPlugin (), AuthorizationRole .SUFFICIENT );
196
+ instance .addPlugin (createLoadFailingPlugin (), AuthControlFlag .SUFFICIENT );
197
+ instance .addPlugin (createAllowedPrefixPlugin (), AuthControlFlag .SUFFICIENT );
198
198
instance .loadAllPlugins ();
199
199
200
200
// all are sufficient - success
@@ -207,8 +207,8 @@ public void testRolePlugin10() {
207
207
@ Test
208
208
public void testRolePlugin11 () {
209
209
AuthorizationFramework instance = getInstance ();
210
- instance .addPlugin (createLoadFailingPlugin (), AuthorizationRole .REQUIRED );
211
- instance .addPlugin (createAllowedPrefixPlugin (), AuthorizationRole .SUFFICIENT );
210
+ instance .addPlugin (createLoadFailingPlugin (), AuthControlFlag .REQUIRED );
211
+ instance .addPlugin (createAllowedPrefixPlugin (), AuthControlFlag .SUFFICIENT );
212
212
instance .loadAllPlugins ();
213
213
214
214
// required load fails
@@ -221,8 +221,8 @@ public void testRolePlugin11() {
221
221
@ Test
222
222
public void testRolePlugin12 () {
223
223
AuthorizationFramework instance = getInstance ();
224
- instance .addPlugin (createLoadFailingPlugin (), AuthorizationRole .SUFFICIENT );
225
- instance .addPlugin (createLoadFailingPlugin (), AuthorizationRole .REQUIRED );
224
+ instance .addPlugin (createLoadFailingPlugin (), AuthControlFlag .SUFFICIENT );
225
+ instance .addPlugin (createLoadFailingPlugin (), AuthControlFlag .REQUIRED );
226
226
instance .loadAllPlugins ();
227
227
228
228
// same instance is not added twice in the plugins
@@ -236,8 +236,8 @@ public void testRolePlugin12() {
236
236
@ Test
237
237
public void testRolePlugin13 () {
238
238
AuthorizationFramework instance = getInstance ();
239
- instance .addPlugin (createLoadFailingPlugin (), AuthorizationRole .REQUIRED );
240
- instance .addPlugin (createLoadFailingPlugin (), AuthorizationRole .SUFFICIENT );
239
+ instance .addPlugin (createLoadFailingPlugin (), AuthControlFlag .REQUIRED );
240
+ instance .addPlugin (createLoadFailingPlugin (), AuthControlFlag .SUFFICIENT );
241
241
instance .loadAllPlugins ();
242
242
243
243
// same instance is not added twice in the plugins
@@ -252,8 +252,8 @@ public void testRolePlugin13() {
252
252
@ Test
253
253
public void testRolePlugins14 () {
254
254
AuthorizationFramework instance = getInstance ();
255
- instance .addPlugin (createTestFailingPlugin (), AuthorizationRole .SUFFICIENT );
256
- instance .addPlugin (createAllowedPrefixPlugin (), AuthorizationRole .REQUIRED );
255
+ instance .addPlugin (createTestFailingPlugin (), AuthControlFlag .SUFFICIENT );
256
+ instance .addPlugin (createAllowedPrefixPlugin (), AuthControlFlag .REQUIRED );
257
257
instance .loadAllPlugins ();
258
258
259
259
// sufficient is ok
@@ -268,8 +268,8 @@ public void testRolePlugins14() {
268
268
@ Test
269
269
public void testRolePlugin15 () {
270
270
AuthorizationFramework instance = getInstance ();
271
- instance .addPlugin (createTestFailingPlugin (), AuthorizationRole .SUFFICIENT );
272
- instance .addPlugin (createAllowedPrefixPlugin (), AuthorizationRole .SUFFICIENT );
271
+ instance .addPlugin (createTestFailingPlugin (), AuthControlFlag .SUFFICIENT );
272
+ instance .addPlugin (createAllowedPrefixPlugin (), AuthControlFlag .SUFFICIENT );
273
273
instance .loadAllPlugins ();
274
274
275
275
// all are sufficient - success
@@ -282,8 +282,8 @@ public void testRolePlugin15() {
282
282
@ Test
283
283
public void testRolePlugin16 () {
284
284
AuthorizationFramework instance = getInstance ();
285
- instance .addPlugin (createTestFailingPlugin (), AuthorizationRole .REQUIRED );
286
- instance .addPlugin (createAllowedPrefixPlugin (), AuthorizationRole .SUFFICIENT );
285
+ instance .addPlugin (createTestFailingPlugin (), AuthControlFlag .REQUIRED );
286
+ instance .addPlugin (createAllowedPrefixPlugin (), AuthControlFlag .SUFFICIENT );
287
287
instance .loadAllPlugins ();
288
288
289
289
// required test fails (exception when group is not allowed)
@@ -296,8 +296,8 @@ public void testRolePlugin16() {
296
296
@ Test
297
297
public void testRolePlugin17 () {
298
298
AuthorizationFramework instance = getInstance ();
299
- instance .addPlugin (createTestFailingPlugin (), AuthorizationRole .SUFFICIENT );
300
- instance .addPlugin (createTestFailingPlugin (), AuthorizationRole .REQUIRED );
299
+ instance .addPlugin (createTestFailingPlugin (), AuthControlFlag .SUFFICIENT );
300
+ instance .addPlugin (createTestFailingPlugin (), AuthControlFlag .REQUIRED );
301
301
instance .loadAllPlugins ();
302
302
303
303
// same instance is not added twice in the plugins and the plugin stays sufficient
@@ -311,8 +311,8 @@ public void testRolePlugin17() {
311
311
@ Test
312
312
public void testRolePlugin18 () {
313
313
AuthorizationFramework instance = getInstance ();
314
- instance .addPlugin (createTestFailingPlugin (), AuthorizationRole .REQUIRED );
315
- instance .addPlugin (createTestFailingPlugin (), AuthorizationRole .SUFFICIENT );
314
+ instance .addPlugin (createTestFailingPlugin (), AuthControlFlag .REQUIRED );
315
+ instance .addPlugin (createTestFailingPlugin (), AuthControlFlag .SUFFICIENT );
316
316
instance .loadAllPlugins ();
317
317
318
318
// same instance is not added twice in the plugins and this instance allows all projects
0 commit comments