-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
16 changed files
with
182 additions
and
140 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
<h1 align="center">ACL Plugin for <a href="http://flextype.org/">Flextype</a></h1> | ||
|
||
<p align="center"> | ||
<a href="https://github.com/flextype-plugins/acl/releases"><img alt="Version" src="https://img.shields.io/github/release/flextype-plugins/acl.svg?label=version&color=black"></a> <a href="https://github.com/flextype-plugins/acl"><img src="https://img.shields.io/badge/license-MIT-blue.svg?color=black" alt="License"></a> <a href="https://github.com/flextype-plugins/acl"><img src="https://img.shields.io/github/downloads/flextype-plugins/acl/total.svg?color=black" alt="Total downloads"></a> <a href="https://github.com/flextype/flextype"><img src="https://img.shields.io/badge/Flextype-0.9.9-green.svg" alt="Flextype"></a> <a href=""><img src="https://img.shields.io/discord/423097982498635778.svg?logo=discord&color=black&label=Discord%20Chat" alt="Discord"></a> | ||
<a href="https://github.com/flextype-plugins/acl/releases"><img alt="Version" src="https://img.shields.io/github/release/flextype-plugins/acl.svg?label=version&color=black"></a> <a href="https://github.com/flextype-plugins/acl"><img src="https://img.shields.io/badge/license-MIT-blue.svg?color=black" alt="License"></a> <a href="https://github.com/flextype-plugins/acl"><img src="https://img.shields.io/github/downloads/flextype-plugins/acl/total.svg?color=black" alt="Total downloads"></a> <a href="https://github.com/flextype/flextype"><img src="https://img.shields.io/badge/Flextype-0.9.10-green.svg" alt="Flextype"></a> <a href=""><img src="https://img.shields.io/discord/423097982498635778.svg?logo=discord&color=black&label=Discord%20Chat" alt="Discord"></a> | ||
</p> | ||
|
||
## Features | ||
|
@@ -15,7 +15,7 @@ The following dependencies need to be downloaded and installed for ACL Plugin. | |
|
||
| Item | Version | Download | | ||
|---|---|---| | ||
| [flextype](https://github.com/flextype/flextype) | 0.9.9 | [download](https://github.com/flextype/flextype/releases) | | ||
| [flextype](https://github.com/flextype/flextype) | 0.9.10 | [download](https://github.com/flextype/flextype/releases) | | ||
| [site](https://github.com/flextype-plugins/site) | >=1.0.0 | [download](https://github.com/flextype-plugins/site/releases) | | ||
| [twig](https://github.com/flextype-plugins/twig) | >=1.0.0 | [download](https://github.com/flextype-plugins/twig/releases) | | ||
|
||
|
@@ -56,7 +56,7 @@ The following dependencies need to be downloaded and installed for ACL Plugin. | |
|
||
#### Example | ||
``` | ||
$app->get('/my-route', 'MyController:method()') | ||
$flextype->get('/my-route', 'MyController:method()') | ||
->setName('my.route.name') | ||
->add(new AclIsUserLoggedInMiddleware(['container' => $flextype, | ||
'redirect' => 'another.route.name'])); | ||
|
@@ -74,7 +74,7 @@ $app->get('/my-route', 'MyController:method()') | |
|
||
#### Example | ||
``` | ||
$app->get('/my-route', 'MyController:method()') | ||
$flextype->get('/my-route', 'MyController:method()') | ||
->setName('my.route.name') | ||
->add(new AclAccountsIsUserLoggedInRolesInMiddleware(['container' => $flextype, | ||
'roles' => 'admin, moderator' | ||
|
@@ -93,7 +93,7 @@ $app->get('/my-route', 'MyController:method()') | |
|
||
#### Example | ||
``` | ||
$app->get('/my-route', 'MyController:method()') | ||
$flextype->get('/my-route', 'MyController:method()') | ||
->setName('my.route.name') | ||
->add(new AclIsUserLoggedInEmailsInMiddleware(['container' => $flextype, | ||
'emails' => '[email protected], [email protected]' | ||
|
@@ -112,7 +112,7 @@ $app->get('/my-route', 'MyController:method()') | |
|
||
#### Example | ||
``` | ||
$app->get('/my-route', 'MyController:method()') | ||
$flextype->get('/my-route', 'MyController:method()') | ||
->setName('my.route.name') | ||
->add(new AclIsUserLoggedInUuidInMiddleware(['container' => $flextype, | ||
'uuids' => 'ea7432a3-b2d5-4b04-b31d-1c5acc7a55e2, d549af27-79a0-44f2-b9b1-e82b47bf87e2' | ||
|
@@ -129,7 +129,7 @@ $app->get('/my-route', 'MyController:method()') | |
|
||
#### Example | ||
``` | ||
$app->get('/my-route', 'MyController:method()') | ||
$flextype->get('/my-route', 'MyController:method()') | ||
->setName('my.route.name') | ||
->add(new AclIsUserNotLoggedInMiddleware(['container' => $flextype, | ||
'redirect' => 'another.route.name'])); | ||
|
@@ -147,7 +147,7 @@ $app->get('/my-route', 'MyController:method()') | |
|
||
#### Example | ||
``` | ||
$app->get('/my-route', 'MyController:method()') | ||
$flextype->get('/my-route', 'MyController:method()') | ||
->setName('my.route.name') | ||
->add(new AclAccountsIsUserLoggedInRolesNotInMiddleware(['container' => $flextype, | ||
'roles' => 'admin, moderator' | ||
|
@@ -166,7 +166,7 @@ $app->get('/my-route', 'MyController:method()') | |
|
||
#### Example | ||
``` | ||
$app->get('/my-route', 'MyController:method()') | ||
$flextype->get('/my-route', 'MyController:method()') | ||
->setName('my.route.name') | ||
->add(new AclIsUserLoggedInEmailsNotInMiddleware(['container' => $flextype, | ||
'emails' => '[email protected], [email protected]' | ||
|
@@ -185,7 +185,7 @@ $app->get('/my-route', 'MyController:method()') | |
|
||
#### Example | ||
``` | ||
$app->get('/my-route', 'MyController:method()') | ||
$flextype->get('/my-route', 'MyController:method()') | ||
->setName('my.route.name') | ||
->add(new AclIsUserLoggedInUuidNotInMiddleware(['container' => $flextype, | ||
'uuids' => 'ea7432a3-b2d5-4b04-b31d-1c5acc7a55e2, d549af27-79a0-44f2-b9b1-e82b47bf87e2' | ||
|
@@ -513,54 +513,54 @@ You may restrict access for specific users to your specific code in the PHP. | |
#### Run private code for logged in users | ||
|
||
```php | ||
if ($flextype->acl->isUserLoggedIn()) { | ||
if ($flextype->container('acl')->isUserLoggedIn()) { | ||
// Private code here.. | ||
} | ||
``` | ||
|
||
#### Run private content for users with roles: admin and student | ||
|
||
```php | ||
if ($flextype->acl->isUserLoggedInRolesIn('admin, student')) { | ||
if ($flextype->container('acl')->isUserLoggedInRolesIn('admin, student')) { | ||
// Private code here.. | ||
} | ||
``` | ||
|
||
#### Run private code for users with uuids ea7432a3-b2d5-4b04-b31d-1c5acc7a55e2 and d549af27-79a0-44f2-b9b1-e82b47bf87e2 | ||
|
||
```php | ||
if ($flextype->acl->isUserLoggedInUuidIn('ea7432a3-b2d5-4b04-b31d-1c5acc7a55e2, d549af27-79a0-44f2-b9b1-e82b47bf87e2') { | ||
if ($flextype->container('acl')->isUserLoggedInUuidIn('ea7432a3-b2d5-4b04-b31d-1c5acc7a55e2, d549af27-79a0-44f2-b9b1-e82b47bf87e2') { | ||
// Private content here.. | ||
} | ||
``` | ||
|
||
#### Run private code for users with emails [email protected], [email protected] | ||
|
||
```php | ||
if ($flextype->acl->isUserLoggedInEmailIn('[email protected], [email protected]')) { | ||
if ($flextype->container('acl')->isUserLoggedInEmailIn('[email protected], [email protected]')) { | ||
// Private content here.. | ||
} | ||
``` | ||
|
||
#### Show logged in email | ||
|
||
```php | ||
echo 'Hello ' . $flextype->acl->getUserLoggedInEmail(); | ||
echo 'Hello ' . $flextype->container('acl')->getUserLoggedInEmail(); | ||
``` | ||
|
||
#### Show logged in uuid | ||
|
||
```php | ||
echo 'Hello ' . $flextype->acl->getUserLoggedInEmail(); | ||
echo 'your uuid: ' . $flextype->acl->getUserLoggedInUuid(); | ||
echo 'Hello ' . $flextype->container('acl')->getUserLoggedInEmail(); | ||
echo 'your uuid: ' . $flextype->container('acl')->getUserLoggedInUuid(); | ||
``` | ||
|
||
#### Show logged in roles | ||
|
||
```php | ||
echo 'Hello ' . $flextype->acl->getUserLoggedInEmail(); | ||
echo 'your uuid: ' . $flextype->acl->getUserLoggedInUuid(); | ||
echo 'and your roles: ' . $flextype->acl->getUserLoggedInRoles(); | ||
echo 'Hello ' . $flextype->container('acl')->getUserLoggedInEmail(); | ||
echo 'your uuid: ' . $flextype->container('acl')->getUserLoggedInUuid(); | ||
echo 'and your roles: ' . $flextype->container('acl')->getUserLoggedInRoles(); | ||
``` | ||
|
||
## LICENSE | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.