ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
Sabre\DAVACL\ACLMethodTest Class Reference
+ Inheritance diagram for Sabre\DAVACL\ACLMethodTest:
+ Collaboration diagram for Sabre\DAVACL\ACLMethodTest:

Public Member Functions

 testCallback ()
 Sabre More...
 
 testNotSupportedByNode ()
 /** Sabre More...
 
 testSuccessSimple ()
 
 testUnrecognizedPrincipal ()
 Sabre More...
 
 testUnrecognizedPrincipal2 ()
 Sabre More...
 
 testUnknownPrivilege ()
 Sabre More...
 
 testAbstractPrivilege ()
 Sabre More...
 
 testUpdateProtectedPrivilege ()
 Sabre More...
 
 testUpdateProtectedPrivilege2 ()
 Sabre More...
 
 testUpdateProtectedPrivilege3 ()
 Sabre More...
 
 testSuccessComplex ()
 

Detailed Description

Definition at line 8 of file ACLMethodTest.php.

Member Function Documentation

◆ testAbstractPrivilege()

Sabre\DAVACL\ACLMethodTest::testAbstractPrivilege ( )

Sabre

Definition at line 152 of file ACLMethodTest.php.

152  {
153 
154  $tree = [
155  new MockACLNode('test', []),
156  ];
157  $acl = new Plugin();
158  $server = new DAV\Server($tree);
159  $server->on('getSupportedPrivilegeSet', function($node, &$supportedPrivilegeSet) {
160  $supportedPrivilegeSet['{DAV:}foo'] = ['abstract' => true];
161  });
162  $server->httpRequest = new HTTP\Request('ACL', '/test');
163  $body = '<?xml version="1.0"?>
164 <d:acl xmlns:d="DAV:">
165  <d:ace>
166  <d:grant><d:privilege><d:foo /></d:privilege></d:grant>
167  <d:principal><d:href>/principals/foo/</d:href></d:principal>
168  </d:ace>
169 </d:acl>';
170  $server->httpRequest->setBody($body);
171  $server->addPlugin(new DAV\Auth\Plugin());
172  $server->addPlugin($acl);
173 
174  $acl->httpACL($server->httpRequest, $server->httpResponse);
175 
176  }
$server
Definition: sabredav.php:48

◆ testCallback()

Sabre\DAVACL\ACLMethodTest::testCallback ( )

Sabre

Definition at line 13 of file ACLMethodTest.php.

References $server.

13  {
14 
15  $acl = new Plugin();
16  $server = new DAV\Server();
17  $server->addPlugin(new DAV\Auth\Plugin());
18  $server->addPlugin($acl);
19 
20  $acl->httpAcl($server->httpRequest, $server->httpResponse);
21 
22  }
$server
Definition: sabredav.php:48

◆ testNotSupportedByNode()

Sabre\DAVACL\ACLMethodTest::testNotSupportedByNode ( )

/** Sabre

Definition at line 28 of file ACLMethodTest.php.

28  {
29 
30  $tree = [
31  new DAV\SimpleCollection('test'),
32  ];
33  $acl = new Plugin();
34  $server = new DAV\Server($tree);
35  $server->httpRequest = new HTTP\Request();
36  $body = '<?xml version="1.0"?>
37 <d:acl xmlns:d="DAV:">
38 </d:acl>';
39  $server->httpRequest->setBody($body);
40  $server->addPlugin(new DAV\Auth\Plugin());
41  $server->addPlugin($acl);
42 
43  $acl->httpACL($server->httpRequest, $server->httpResponse);
44 
45  }
$server
Definition: sabredav.php:48

◆ testSuccessComplex()

Sabre\DAVACL\ACLMethodTest::testSuccessComplex ( )

Definition at line 280 of file ACLMethodTest.php.

280  {
281 
282  $oldACL = [
283  [
284  'principal' => 'principals/foo',
285  'privilege' => '{DAV:}write',
286  'protected' => true,
287  ],
288  [
289  'principal' => 'principals/bar',
290  'privilege' => '{DAV:}read',
291  ],
292  ];
293 
294  $tree = [
295  $node = new MockACLNode('test', $oldACL),
296  new DAV\SimpleCollection('principals', [
297  new MockPrincipal('foo', 'principals/foo'),
298  new MockPrincipal('baz', 'principals/baz'),
299  ]),
300  ];
301  $acl = new Plugin();
302  $server = new DAV\Server($tree);
303  $server->httpRequest = new HTTP\Request('ACL', '/test');
304  $body = '<?xml version="1.0"?>
305 <d:acl xmlns:d="DAV:">
306  <d:ace>
307  <d:grant><d:privilege><d:write /></d:privilege></d:grant>
308  <d:principal><d:href>/principals/foo</d:href></d:principal>
309  <d:protected />
310  </d:ace>
311  <d:ace>
312  <d:grant><d:privilege><d:write /></d:privilege></d:grant>
313  <d:principal><d:href>/principals/baz</d:href></d:principal>
314  </d:ace>
315 </d:acl>';
316  $server->httpRequest->setBody($body);
317  $server->addPlugin(new DAV\Auth\Plugin());
318  $server->addPlugin($acl);
319 
320 
321  $this->assertFalse($acl->httpAcl($server->httpRequest, $server->httpResponse));
322 
323  $this->assertEquals([
324  [
325  'principal' => 'principals/foo',
326  'privilege' => '{DAV:}write',
327  'protected' => true,
328  ],
329  [
330  'principal' => 'principals/baz',
331  'privilege' => '{DAV:}write',
332  'protected' => false,
333  ],
334  ], $node->getACL());
335 
336  }
$server
Definition: sabredav.php:48

◆ testSuccessSimple()

Sabre\DAVACL\ACLMethodTest::testSuccessSimple ( )

Definition at line 47 of file ACLMethodTest.php.

47  {
48 
49  $tree = [
50  new MockACLNode('test', []),
51  ];
52  $acl = new Plugin();
53  $server = new DAV\Server($tree);
54  $server->httpRequest = new HTTP\Request();
55  $server->httpRequest->setUrl('/test');
56 
57  $body = '<?xml version="1.0"?>
58 <d:acl xmlns:d="DAV:">
59 </d:acl>';
60  $server->httpRequest->setBody($body);
61  $server->addPlugin(new DAV\Auth\Plugin());
62  $server->addPlugin($acl);
63 
64  $this->assertFalse($acl->httpACL($server->httpRequest, $server->httpResponse));
65 
66  }
$server
Definition: sabredav.php:48

◆ testUnknownPrivilege()

Sabre\DAVACL\ACLMethodTest::testUnknownPrivilege ( )

Sabre

Definition at line 126 of file ACLMethodTest.php.

126  {
127 
128  $tree = [
129  new MockACLNode('test', []),
130  ];
131  $acl = new Plugin();
132  $server = new DAV\Server($tree);
133  $server->httpRequest = new HTTP\Request('ACL', '/test');
134  $body = '<?xml version="1.0"?>
135 <d:acl xmlns:d="DAV:">
136  <d:ace>
137  <d:grant><d:privilege><d:bananas /></d:privilege></d:grant>
138  <d:principal><d:href>/principals/notfound</d:href></d:principal>
139  </d:ace>
140 </d:acl>';
141  $server->httpRequest->setBody($body);
142  $server->addPlugin(new DAV\Auth\Plugin());
143  $server->addPlugin($acl);
144 
145  $acl->httpACL($server->httpRequest, $server->httpResponse);
146 
147  }
$server
Definition: sabredav.php:48

◆ testUnrecognizedPrincipal()

Sabre\DAVACL\ACLMethodTest::testUnrecognizedPrincipal ( )

Sabre

Definition at line 71 of file ACLMethodTest.php.

71  {
72 
73  $tree = [
74  new MockACLNode('test', []),
75  ];
76  $acl = new Plugin();
77  $server = new DAV\Server($tree);
78  $server->httpRequest = new HTTP\Request('ACL', '/test');
79  $body = '<?xml version="1.0"?>
80 <d:acl xmlns:d="DAV:">
81  <d:ace>
82  <d:grant><d:privilege><d:read /></d:privilege></d:grant>
83  <d:principal><d:href>/principals/notfound</d:href></d:principal>
84  </d:ace>
85 </d:acl>';
86  $server->httpRequest->setBody($body);
87  $server->addPlugin(new DAV\Auth\Plugin());
88  $server->addPlugin($acl);
89 
90  $acl->httpACL($server->httpRequest, $server->httpResponse);
91 
92  }
$server
Definition: sabredav.php:48

◆ testUnrecognizedPrincipal2()

Sabre\DAVACL\ACLMethodTest::testUnrecognizedPrincipal2 ( )

Sabre

Definition at line 97 of file ACLMethodTest.php.

97  {
98 
99  $tree = [
100  new MockACLNode('test', []),
101  new DAV\SimpleCollection('principals', [
102  new DAV\SimpleCollection('notaprincipal'),
103  ]),
104  ];
105  $acl = new Plugin();
106  $server = new DAV\Server($tree);
107  $server->httpRequest = new HTTP\Request('ACL', '/test');
108  $body = '<?xml version="1.0"?>
109 <d:acl xmlns:d="DAV:">
110  <d:ace>
111  <d:grant><d:privilege><d:read /></d:privilege></d:grant>
112  <d:principal><d:href>/principals/notaprincipal</d:href></d:principal>
113  </d:ace>
114 </d:acl>';
115  $server->httpRequest->setBody($body);
116  $server->addPlugin(new DAV\Auth\Plugin());
117  $server->addPlugin($acl);
118 
119  $acl->httpACL($server->httpRequest, $server->httpResponse);
120 
121  }
$server
Definition: sabredav.php:48

◆ testUpdateProtectedPrivilege()

Sabre\DAVACL\ACLMethodTest::testUpdateProtectedPrivilege ( )

Sabre

Definition at line 181 of file ACLMethodTest.php.

181  {
182 
183  $oldACL = [
184  [
185  'principal' => 'principals/notfound',
186  'privilege' => '{DAV:}write',
187  'protected' => true,
188  ],
189  ];
190 
191  $tree = [
192  new MockACLNode('test', $oldACL),
193  ];
194  $acl = new Plugin();
195  $server = new DAV\Server($tree);
196  $server->httpRequest = new HTTP\Request('ACL', '/test');
197  $body = '<?xml version="1.0"?>
198 <d:acl xmlns:d="DAV:">
199  <d:ace>
200  <d:grant><d:privilege><d:read /></d:privilege></d:grant>
201  <d:principal><d:href>/principals/notfound</d:href></d:principal>
202  </d:ace>
203 </d:acl>';
204  $server->httpRequest->setBody($body);
205  $server->addPlugin(new DAV\Auth\Plugin());
206  $server->addPlugin($acl);
207 
208  $acl->httpACL($server->httpRequest, $server->httpResponse);
209 
210  }
$server
Definition: sabredav.php:48

◆ testUpdateProtectedPrivilege2()

Sabre\DAVACL\ACLMethodTest::testUpdateProtectedPrivilege2 ( )

Sabre

Definition at line 215 of file ACLMethodTest.php.

215  {
216 
217  $oldACL = [
218  [
219  'principal' => 'principals/notfound',
220  'privilege' => '{DAV:}write',
221  'protected' => true,
222  ],
223  ];
224 
225  $tree = [
226  new MockACLNode('test', $oldACL),
227  ];
228  $acl = new Plugin();
229  $server = new DAV\Server($tree);
230  $server->httpRequest = new HTTP\Request('ACL', '/test');
231  $body = '<?xml version="1.0"?>
232 <d:acl xmlns:d="DAV:">
233  <d:ace>
234  <d:grant><d:privilege><d:write /></d:privilege></d:grant>
235  <d:principal><d:href>/principals/foo</d:href></d:principal>
236  </d:ace>
237 </d:acl>';
238  $server->httpRequest->setBody($body);
239  $server->addPlugin(new DAV\Auth\Plugin());
240  $server->addPlugin($acl);
241 
242  $acl->httpACL($server->httpRequest, $server->httpResponse);
243 
244  }
$server
Definition: sabredav.php:48

◆ testUpdateProtectedPrivilege3()

Sabre\DAVACL\ACLMethodTest::testUpdateProtectedPrivilege3 ( )

Sabre

Definition at line 249 of file ACLMethodTest.php.

249  {
250 
251  $oldACL = [
252  [
253  'principal' => 'principals/notfound',
254  'privilege' => '{DAV:}write',
255  'protected' => true,
256  ],
257  ];
258 
259  $tree = [
260  new MockACLNode('test', $oldACL),
261  ];
262  $acl = new Plugin();
263  $server = new DAV\Server($tree);
264  $server->httpRequest = new HTTP\Request('ACL', '/test');
265  $body = '<?xml version="1.0"?>
266 <d:acl xmlns:d="DAV:">
267  <d:ace>
268  <d:grant><d:privilege><d:write /></d:privilege></d:grant>
269  <d:principal><d:href>/principals/notfound</d:href></d:principal>
270  </d:ace>
271 </d:acl>';
272  $server->httpRequest->setBody($body);
273  $server->addPlugin(new DAV\Auth\Plugin());
274  $server->addPlugin($acl);
275 
276  $acl->httpACL($server->httpRequest, $server->httpResponse);
277 
278  }
$server
Definition: sabredav.php:48

The documentation for this class was generated from the following file: