|
|
@ -9,11 +9,27 @@ After Quick Start, Take a look [detailed Documentation from wiki](https://github |
|
|
|
* Group Operations (Creaing, deleting groups, membership management) |
|
|
|
* Group Operations (Creaing, deleting groups, membership management) |
|
|
|
* Admin and Public Group support (Public permissions) |
|
|
|
* Admin and Public Group support (Public permissions) |
|
|
|
Permission Management (creating,deleting permissons, allow, deny groups, public permissions, permission checking) |
|
|
|
Permission Management (creating,deleting permissons, allow, deny groups, public permissions, permission checking) |
|
|
|
|
|
|
|
* Group Permissions |
|
|
|
|
|
|
|
* User Permissions (new) |
|
|
|
|
|
|
|
* User and System Variables (new) |
|
|
|
|
|
|
|
* Login Ddos Protection (new) |
|
|
|
* Private Messages (pm between users) |
|
|
|
* Private Messages (pm between users) |
|
|
|
* Error Mesages and Validations |
|
|
|
* Error Mesages and Validations |
|
|
|
* Langugage and config file support |
|
|
|
* Langugage and config file support |
|
|
|
* Flexible |
|
|
|
* Flexible |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
### What is new in Version 2 |
|
|
|
|
|
|
|
*** |
|
|
|
|
|
|
|
* User Permissions |
|
|
|
|
|
|
|
* User and System Variables |
|
|
|
|
|
|
|
* Login Ddos Protection |
|
|
|
|
|
|
|
* Some functions has changed |
|
|
|
|
|
|
|
* Some bugs fixed |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
### Migration |
|
|
|
|
|
|
|
*** |
|
|
|
|
|
|
|
* if you have been using Version 1 before, take a look at Migration Page from here. |
|
|
|
|
|
|
|
|
|
|
|
### Quick Start |
|
|
|
### Quick Start |
|
|
|
*** |
|
|
|
*** |
|
|
|
Let's start :) |
|
|
|
Let's start :) |
|
|
@ -36,10 +52,15 @@ thats it. now we have two users. |
|
|
|
Lets Create two group governors and commons :) |
|
|
|
Lets Create two group governors and commons :) |
|
|
|
```php |
|
|
|
```php |
|
|
|
$this->aauth->create_group('governors'); |
|
|
|
$this->aauth->create_group('governors'); |
|
|
|
$this->aauth->create_user('commons'); |
|
|
|
$this->aauth->create_group('commons'); |
|
|
|
``` |
|
|
|
``` |
|
|
|
|
|
|
|
|
|
|
|
ok now we have two groups. |
|
|
|
Then, Lets Create a User with power whic is Obama (having id=12) |
|
|
|
|
|
|
|
```php |
|
|
|
|
|
|
|
$this->aauth->create_user('obama@usa.gov', 'pass-cia-fbi', 'Barrack Obama'); |
|
|
|
|
|
|
|
``` |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ok now we have two groups and one user. |
|
|
|
|
|
|
|
|
|
|
|
Lets create a permissions 'incrase_tax' and 'change_government' |
|
|
|
Lets create a permissions 'incrase_tax' and 'change_government' |
|
|
|
|
|
|
|
|
|
|
@ -49,14 +70,14 @@ $this->aauth->create_perm('change_government'); |
|
|
|
``` |
|
|
|
``` |
|
|
|
|
|
|
|
|
|
|
|
Ok, now lets give accesses. logically 'governors' will have 'increase_tax' permission and 'commons' will have 'change_government' access. |
|
|
|
Ok, now lets give accesses. logically 'governors' will have 'increase_tax' permission and 'commons' will have 'change_government' access. |
|
|
|
ok lets give proper access with _alow()_ function |
|
|
|
ok lets give proper access with _alow_group()_ function |
|
|
|
|
|
|
|
|
|
|
|
```php |
|
|
|
```php |
|
|
|
$this->aauth->allow('governors','increase_tax'); |
|
|
|
$this->aauth->allow_group('governors','increase_tax'); |
|
|
|
$this->aauth->allow('commons','change_government'); |
|
|
|
$this->aauth->allow_group('commons','change_government'); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$this->aauth->allow('commons','increase_tax'); |
|
|
|
$this->aauth->allow_group('commons','increase_tax'); |
|
|
|
``` |
|
|
|
``` |
|
|
|
|
|
|
|
|
|
|
|
Ops wait a minute. commons cannot 'increase_tax'. we need to fix it, we will use deny() to take back permission. |
|
|
|
Ops wait a minute. commons cannot 'increase_tax'. we need to fix it, we will use deny() to take back permission. |
|
|
@ -65,34 +86,74 @@ Ops wait a minute. commons cannot 'increase_tax'. we need to fix it, we will us |
|
|
|
$this->aauth->deny('commons','increase_tax'); |
|
|
|
$this->aauth->deny('commons','increase_tax'); |
|
|
|
``` |
|
|
|
``` |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Obama also can increse tax ha? |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
```php |
|
|
|
|
|
|
|
$this->aauth->allow_user(12,'increase_tax'); |
|
|
|
|
|
|
|
``` |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Ok now lets check if commons can 'increase_tax' |
|
|
|
Ok now lets check if commons can 'increase_tax' |
|
|
|
|
|
|
|
|
|
|
|
```php |
|
|
|
```php |
|
|
|
if($this->aauth->is_allowed('commons','increase_tax')){ |
|
|
|
if($this->aauth->is_group_allowed('commons','increase_tax')){ |
|
|
|
// i dont think so |
|
|
|
// i dont think so |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
// do sth in the middle |
|
|
|
// do sth in the middle |
|
|
|
} |
|
|
|
} |
|
|
|
``` |
|
|
|
``` |
|
|
|
|
|
|
|
|
|
|
|
i think 'increse_tax' must have never been created. delete it |
|
|
|
Can Obama increase_tax ? Let's check it. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
```php |
|
|
|
|
|
|
|
if($this->aauth->is_allowed(15,'increase_tax')){ |
|
|
|
|
|
|
|
// i guess so |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
// piece of code |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
``` |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
i think 'increse_tax' must have never been created. just delete it |
|
|
|
|
|
|
|
|
|
|
|
```php |
|
|
|
```php |
|
|
|
$this->aauth->delete_perm('increase_tax'); |
|
|
|
$this->aauth->delete_perm('increase_tax'); |
|
|
|
``` |
|
|
|
``` |
|
|
|
now better. |
|
|
|
now better. |
|
|
|
|
|
|
|
|
|
|
|
So what about public people? (public means not logged users). can public people travel? Lets assume we have permissions namely 'travel' , of course. |
|
|
|
So what about public people? (public means not logged users). Can public people travel? Lets assume we have permissions namely 'travel' , of course. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
```php |
|
|
|
|
|
|
|
$this->aauth->allow_group('public','travel'); |
|
|
|
|
|
|
|
``` |
|
|
|
|
|
|
|
|
|
|
|
> $this->aauth->allow('public','travel') |
|
|
|
So Admin? what can he do? He can access everthing, You dont need to give permiision ( using allow_group() or allow_user() ) him, he already has. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
What about User Variables? |
|
|
|
|
|
|
|
for every individual user, variables can be defined as key-value. |
|
|
|
|
|
|
|
|
|
|
|
So Admin? what can he do? He can access everthing, You dont need to give permiision ( allow() ) him, he already has. |
|
|
|
this is a simple example to set a variable. |
|
|
|
|
|
|
|
```php |
|
|
|
|
|
|
|
$this->aauth->set_user_var("key","value"); |
|
|
|
|
|
|
|
``` |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
For example if you want to keep users phones |
|
|
|
|
|
|
|
```php |
|
|
|
|
|
|
|
$this->aauth->set_user_var("phone","0216 313 23 33"); |
|
|
|
|
|
|
|
``` |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
to get the variable |
|
|
|
|
|
|
|
```php |
|
|
|
|
|
|
|
$this->aauth->set_user_var("key"); |
|
|
|
|
|
|
|
``` |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Aauth also permits you to define System Variables which can be accesed by every user in the system. |
|
|
|
|
|
|
|
```php |
|
|
|
|
|
|
|
$this->aauth->set_system_var("key","Value"); |
|
|
|
|
|
|
|
$this->aauth->set_system_var("key"); |
|
|
|
|
|
|
|
``` |
|
|
|
|
|
|
|
|
|
|
|
ok lets lokk at private messages. John (his id=3) will send pm to Ali(id=4) |
|
|
|
ok lets look at private messages. John (his id=3) will send pm to Ali(id=4) |
|
|
|
|
|
|
|
|
|
|
|
```php |
|
|
|
```php |
|
|
|
$this->aauth->send_pm(3,4,'Hi bro. i need you',' can you gimme your credit card?') |
|
|
|
$this->aauth->send_pm(3,4,'Hi bro. i need you',' can you gimme your credit card?') |
|
|
|