Skip to content
This repository has been archived by the owner on May 14, 2018. It is now read-only.

Commit

Permalink
Merge branch 'readme-updates'
Browse files Browse the repository at this point in the history
Includes commits from #26
  • Loading branch information
bjyoungblood committed Sep 14, 2012
2 parents 7a3c275 + 5d0d938 commit 19e9730
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 5 deletions.
7 changes: 7 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Copyright (C) 2012 Ben Youngblood

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
52 changes: 47 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,44 @@ its usage with modules and applications. By default, it provides simple
setup via config files or by using Zend\Db. This module also comes with
out-of-the-box support for and integration with ZfcUser.

Usage and Configuration
-----------------------
Here is an annotated sample configuration file:
# create this file in config/autoload/BjyAuthorize.global.php
Requirements
------------
* [Zend Framework 2](https://github.com/zendframework/zf2) (latest master)
* [ZfcBase](https://github.com/ZF-Commons/ZfcBase) (latest master)
* [ZfcUser](https://github.com/ZF-Commons/ZfcUser) (latest master)

Installation
------------
### (1) Installation

Choose one of the two available installation methods:

#### Composer

Currently this medthod of installation is not working.

#### Git Submodule

1. Follow the [ZfcUser](https://github.com/ZF-Commons/ZfcUser) installation instructions to install that module and it's dependencies.

2. Clone this project into your `./vendor/` directory
```
cd vendor;
git clone git://github.com/bjyoungblood/BjyAuthorize.git;
```

### (2) Configuration

1. Ensure that this module and it's dependencies are enabled in your `application.config.php` file in the following order:
* ZfcBase
* ZfcUser
* BjyAuthorize
3. Import the SQL schema located in `./vendor/BjyAuthorize/data/schema.sql`.
4. Copy `./vendor/BjyAuthorize/config/module.config.php` to
`./config/autoload/module.bjyauthorize.global.php`.
5. Fill in the required configuration variable values in `./config/autoload/module.bjyauthorize.global.php`

Here is an annotated sample configuration file:
```php
<?php

Expand Down Expand Up @@ -103,7 +136,9 @@ return array(
'BjyAuthorize\Guard\Controller' => array(
array('controller' => 'index', 'action' => 'index', 'roles' => array('guest','user')),
array('controller' => 'index', 'action' => 'stuff', 'roles' => array('user')),
array('controller' => 'zfcuser', 'roles' => array())
array('controller' => 'zfcuser', 'roles' => array()),
// Below is the default index action used by the [ZendSkeletonApplication](https://github.com/zendframework/ZendSkeletonApplication)
// array('controller' => 'Application\Controller\Index', 'roles' => array('guest', 'user')),
),

/* If this guard is specified here (i.e. it is enabled), it will block
Expand All @@ -114,6 +149,8 @@ return array(
array('route' => 'zfcuser/logout', 'roles' => array('user')),
array('route' => 'zfcuser/login', 'roles' => array('guest')),
array('route' => 'zfcuser/register', 'roles' => array('guest')),
// Below is the default index action used by the [ZendSkeletonApplication](https://github.com/zendframework/ZendSkeletonApplication)
array('route' => 'home', 'roles' => array('guest', 'user')),
),
),
),
Expand All @@ -126,3 +163,8 @@ There are view helpers and controller plugins registered for this module.
In either a controller or a view script, you can call
```$this->isAllowed($resource[, $privilege])```, which will query the ACL
using the currently authenticated (or default) user's roles.

License
-------
Released under the MIT License. See file LICENSE included with the source
code for this project for a copy of the licensing terms.

0 comments on commit 19e9730

Please sign in to comment.