Skip to content

Commit fcdfa22

Browse files
committed
Updated Readme
1 parent 687f175 commit fcdfa22

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed

README.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,3 +122,19 @@ $app->add(function (Request $request, Response $res, $next) {
122122
}
123123
});
124124
```
125+
126+
127+
## White listing
128+
You may add a URI path for white listing. The whitelisting is based upon `strpos()` so you may use a URI fragment to whitelist a whole class of URIs.
129+
With this it is possible to whitelist URIs by accident.
130+
131+
Example:
132+
```php
133+
134+
$acl = new Acl();
135+
$acl->addWhitelistItem('/api');
136+
```
137+
138+
In this example any URI with `/api` will be whitelisted.
139+
- `/api/*`
140+
- `/myexample/api/*`

tests/AclRepositoryTest.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,5 +180,15 @@ public function testAclRepoUser2_yes() {
180180
$this->assertEquals(200, $output->getStatusCode());
181181
}
182182

183+
public function testAclRepoGuest_Whitelist() {
184+
$reqRoot = $this->mockRequest('/yes');
185+
$res = $this->mockResponse(401);
186+
187+
$acl = $this->user2;
188+
$acl->addWhiteListUri('/yes');
189+
$output = $acl($reqRoot, $res, $this->getClosure());
190+
191+
$this->assertEquals(200, $output->getStatusCode());
192+
}
183193

184194
}

0 commit comments

Comments
 (0)