Browse Source

Edited README.md for grammer and content

Edited README.md for grammer. It should read a little easier now.  Also removed politically
charged references and replaced with something less polarizing (LoTR).
develop
tswagger 10 years ago
parent
commit
6de68fe3be
  1. 151
      README.md

151
README.md

@ -1,172 +1,183 @@
*** ***
Aauth is a User Authorization Library for CodeIgniter 2.x, which aims to make easy some essential jobs such as login, permissions and access operations. Despite ease of use, it has also very advanced features like private messages, groupping, access management, public access etc.. Aauth is a User Authorization Library for CodeIgniter 2.x, which aims to make easy some essential jobs such as login, permissions and access operations. Despite its ease of use, it has also very advanced features like private messages, groupping, access management, and public access.
**This is Quick Start page. After Quick Start, Take a look [detailed Documentation from wiki](https://github.com/emreakay/CodeIgniter-Aauth/wiki/_pages) to learn other great Features** **This is Quick Start page. You can also take a look at the [detailed Documentation Wiki](https://github.com/emreakay/CodeIgniter-Aauth/wiki/_pages) to learn about other great Features**
### Features ### Features
*** ***
* User Management and Operations (login, logout, register, vertification via e-mail, forgoten password, ban management, login ddos protection) * User Management and Operations (login, logout, register, verification via e-mail, forgotten password, user ban, login DDoS protection)
* Group Operations (Creaing, deleting groups, membership management) * Group Operations (creating/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 permissions, allow/deny groups, public permissions, permission checking)
* Group Permissions * Group Permissions
* User Permissions (new) * User Permissions
* User and System Variables (new) * User and System Variables
* Login Ddos Protection (new) * Login DDoS Protection
* Private Messages (pm between users) * Private Messages (between users)
* Error Mesages and Validations * Error Messages and Validations
* Langugage and config file support * Langugage and config file support
* Flexible * Flexible implementation
### What is new in Version 2 ### What is new in Version 2
*** ***
* User Permissions * User Permissions
* User and System Variables * User and System Variables
* Login Ddos Protection * Login DDoS Protection
* Some functions has changed * Updated functions (check documentation for details)
* Some bugs fixed * Bugs fixes
### Migration ### Migration
*** ***
* if you have been using Version 1 before, take a look at [migration page from here.](https://github.com/emreakay/CodeIgniter-Aauth/wiki/1%29-Migration-from-V1). * If you are currently using Version 1, take a look at the [v1 to v2 migration page.](https://github.com/emreakay/CodeIgniter-Aauth/wiki/1%29-Migration-from-V1).
### Quick Start ### Quick Start
*** ***
Let's start :) Let's get started :)
Firstly we will load Aauth Library to system First, we will load the Aauth Library into the system
```php ```php
$this->load->library("Aauth"); $this->load->library("Aauth");
``` ```
thats OK. That was easy!
Now we will create 2 new users, Ali and John Now let's create two new users, `Frodo` and `Legolas`.
```php ```php
$this->aauth->create_user('ali@ali.com','alispass','Ali Akay'); $this->aauth->create_user('frodo@example.com','frodopass','Frodo Baggins');
$this->aauth->create_user('john@john.com','johnspass','John Button'); $this->aauth->create_user('legolas@example.com','legolaspass','Legolas');
``` ```
thats it. now we have two users. We now we have two users.
Lets Create two group governors and commons :) OK, now we can create two groups, `hobbits` and `elves`.
```php ```php
$this->aauth->create_group('governors'); $this->aauth->create_group('hobbits');
$this->aauth->create_group('commons'); $this->aauth->create_group('elves');
``` ```
Then, Lets Create a User with power whic is Obama (having id=12) Now, let's create a user with power, Gandalf (for our example, let's assume he was given the `id` of 12).
```php ```php
$this->aauth->create_user('obama@usa.gov', 'pass-cia-fbi', 'Barrack Obama'); $this->aauth->create_user('gandalf@example.com', 'gandalfpass', 'Gandalf the Gray');
``` ```
ok now we have two groups and one user. OK, now we have two groups and three users.
Lets create a permissions 'incrase_tax' and 'change_government' Let's create two permissions `walk_unseen` and `immortality`
```php ```php
$this->aauth->create_perm('increase_tax'); $this->aauth->create_perm('walk_unseen');
$this->aauth->create_perm('change_government'); $this->aauth->create_perm('immortality');
``` ```
Ok, now lets give accesses. logically 'governors' will have 'increase_tax' permission and 'commons' will have 'change_government' access. Ok, now let's give accesses to our groups. The Hobbits seem to have ability to walk unseen, so we will assign that privilage to them. The Elves have imortality, so we will assign that privilage to them.
ok lets give proper access with _alow_group()_ function We will assign access with `allow_group()` function.
```php ```php
$this->aauth->allow_group('governors','increase_tax'); $this->aauth->allow_group('hobbits','walk_unseen');
$this->aauth->allow_group('commons','change_government'); $this->aauth->allow_group('elves','immortality');
$this->aauth->allow_group('commons','increase_tax'); $this->aauth->allow_group('hobbits','immortality');
``` ```
Ops wait a minute. commons cannot 'increase_tax'. we need to fix it, we will use deny() to take back permission. Wait a minute! Hobbits should not have `immortality`. We need to fix this, we can use `deny()` to remove the permission.
```php ```php
$this->aauth->deny('commons','increase_tax'); $this->aauth->deny('hobbits','immortality');
``` ```
Obama also can increse tax ha? Gandalf can also live forever.
```php ```php
$this->aauth->allow_user(12,'increase_tax'); $this->aauth->allow_user(12,'immortality');
``` ```
Ok now let's check if Hobbits have `immortality`.
Ok now lets check if commons can 'increase_tax'
```php ```php
if($this->aauth->is_group_allowed('commons','increase_tax')){ if($this->aauth->is_group_allowed('hobbits','immortality')){
// i dont think so echo "Hobbits are immortal";
} else { } else {
// do sth in the middle echo "Hobbits are NOT immortal";
} }
``` ```
Results:
```
Hobbits are NOT immortal
```
Can Obama increase_tax ? Let's check it. Does Gandalf have the ability to live forever?
```php ```php
if($this->aauth->is_allowed(15,'increase_tax')){ if($this->aauth->is_allowed(12,'immortality')){
// i guess so echo "Gandalf is immortal";
} else { } else {
// piece of code echo "Gandalf is NOT immortal";
} }
``` ```
Results:
```
Gandalf is immortal
```
Since we don't accually live in Middle Earth, we are not aware of actual immortality. Alas, we must delete the permission.
i think 'increse_tax' must have never been created. just delete it
```php ```php
$this->aauth->delete_perm('increase_tax'); $this->aauth->delete_perm('immortality');
``` ```
now better. It is gone.
So what about public people? (public means not logged users). Can public people travel? Lets assume we have permissions namely 'travel' , of course. #### Un-authenticated Users
So, how about un-authenticated users? In Aauth they are part of the `public` group. Let's give them permissions to `travel`.
We will assume we already have a permission set up named `travel`.
```php ```php
$this->aauth->allow_group('public','travel'); $this->aauth->allow_group('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. #### Admin Users
What about the Admin users? The `Admin` user and any member of the `Admin` group is a superuser who had access everthing, There is no need to grant additional permissions.
What about User Variables? #### User Parameters/Variables
for every individual user, variables can be defined as key-value. For each user, variables can be defined as individual key/value pairs.
this is a simple example to set a variable.
```php ```php
$this->aauth->set_user_var("key","value"); $this->aauth->set_user_var("key","value");
``` ```
For example if you want to keep users phones For example, if you want to store a user's phone number.
```php ```php
$this->aauth->set_user_var("phone","0216 313 23 33"); $this->aauth->set_user_var("phone","1-507-555-1234");
``` ```
to get the variable To retreive value you will use `get_user_var()`:
```php ```php
$this->aauth->get_user_var("key"); $this->aauth->get_user_var("key");
``` ```
Aauth also permits you to define System Variables which can be accesed by every user in the system. Aauth also permits you to define System Variables. These can be which can be accesed by all users in the system.
```php ```php
$this->aauth->set_system_var("key","Value"); $this->aauth->set_system_var("key","value");
$this->aauth->get_system_var("key"); $this->aauth->get_system_var("key");
``` ```
ok lets look at private messages. John (his id=3) will send pm to Ali(id=4) #### Private Messages
OK, let's look at private messages. Frodo (`id` = 3) will send a PM to Legolas (`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,'New cloaks','These new cloaks are fantastic!')
``` ```
sorry John you will be banned :( #### Banning users
Frodo has broke the rules and will not need to be banned from the system.
```php ```php
$this->aauth->ban_user(3); $this->aauth->ban_user(3);
``` ```
Quick Start is done but thats not the end You have reached the end of the Quick Start Guide, but please take a look at the [detailed Documentation Wiki](https://github.com/emreakay/CodeIgniter-Aauth/wiki/_pages) for additional information.
Take a look [detailed Documentation from wiki](https://github.com/emreakay/CodeIgniter-Aauth/wiki/_pages)
Dont forget to watch Aauth. Don't forget to keep and eye on Aauth, we are constantly improving the system.
You can also contribute and help me :) You can also contribute and help me out. :)

Loading…
Cancel
Save