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

Commit

Permalink
cleanig up for transfer to friendsofcake
Browse files Browse the repository at this point in the history
  • Loading branch information
ceeram committed Sep 16, 2013
1 parent a79bb9d commit 5452317
Show file tree
Hide file tree
Showing 8 changed files with 205 additions and 136 deletions.
41 changes: 41 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
language: php

php:
- 5.3
- 5.4
- 5.5

env:
global:
- REPO_NAME=Authorize
- PLUGIN_NAME=Authorize
- REQUIRE=""

matrix:
- DB=mysql CAKE_VERSION=master
- DB=mysql CAKE_VERSION=2.5

matrix:
include:
- php: 5.4
env:
- DB=mysql CAKE_VERSION=master COVERALLS=1
- php: 5.4
env:
- DB=mysql CAKE_VERSION=master PHPCS=1

before_script:
- cd ..
- git clone git://github.com/cakephp/cakephp.git --branch $CAKE_VERSION --depth 1
- cd cakephp/app
- git clone https://github.com/FriendsOfCake/travis.git
- ./travis/before_script.sh

script:
- ./travis/script.sh

after_success:
- ./travis/after_success.sh

notifications:
email: false
2 changes: 2 additions & 0 deletions Controller/Component/Acl/HabtmDbAcl.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
* HabtmDbAcl implements an ACL control system in the database like DbAcl with
* User habtm Group checks
*
* Licensed under The MIT License
* For full copyright and license information, please see the LICENSE.txt
*/
class HabtmDbAcl extends DbAcl {

Expand Down
20 changes: 2 additions & 18 deletions Controller/Component/Auth/AclAuthorize.php
Original file line number Diff line number Diff line change
@@ -1,18 +1,4 @@
<?php
/**
* PHP 5
*
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
* Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice.
*
* @copyright Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/

App::uses('BaseAuthorize', 'Controller/Component/Auth');
App::uses('Router', 'Routing');

Expand All @@ -29,10 +15,8 @@
* record, rather than the specific actions being visited, or only what is being
* done to resources.
*
* @package Cake.Controller.Component.Auth
* @since 2.0
* @see AuthComponent::$authenticate
* @see AclComponent::check()
* Licensed under The MIT License
* For full copyright and license information, please see the LICENSE.txt
*/
class AclAuthorize extends BaseAuthorize {

Expand Down
21 changes: 21 additions & 0 deletions LICENSE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
The MIT License (MIT)

Copyright (c) 2013 M. Ypes, aka Ceeram

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.
90 changes: 90 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
# Authorize plugin

Plugin containing some authorize classes for AuthComponent.

Current classes:
- AclAuthorize, row based Acl. AuthComponent adapter, to use together with AclBehavior created acos
- HabtmDbAcl. AclComponent adapter, for User habtm Group Acl. (for database acl only)

## Requirements

- PHP 5.2.8
- CakePHP 2.x

## Installation

_[Manual]_

- Download this: http://github.com/FriendsOfCake/Authorize/zipball/master
- Unzip that download.
- Copy the resulting folder to app/Plugin
- Rename the folder you just copied to Authorize

_[GIT Submodule]_

In your app directory type:
```
git submodule add git://github.com/FriedsOfCake/Authorize.git Plugin/Authorize
git submodule init
git submodule update
```

_[GIT Clone]_

In your plugin directory type
```
git clone git://github.com/FriendsOfCake/Authorize.git Authorize
```

## Usage

In `app/Config/bootstrap.php` add: `CakePlugin::load('Authorize');`

## Configuration AclAuthorize:

Setup the authorize class

Example:
```php
//in $components
public $components = array(
'Auth' => array(
'authorize' => array(
'Controller',
'Authorize.Acl' => array('actionPath' => 'Models/')
)
)
);
//Or in beforeFilter()
$this->Auth->authorize = array(
'Controller',
'Authorize.Acl' => array('actionPath' => 'Models/')
);
```
In the above example `ControllerAuthorize` is checked first. If your `Controller::isAuthorized()`
returns true on admin routing, AclAuthorize will only be checked for non-admin urls.
Also you need to set `actionPath` in a similar way which is used with Actions- and CrudAuthorize.

## Configuration HabtmDbAcl:

Setup the HabtmDbAcl adapter

in app/Config/core.php
```php
Configure::write('Acl.classname', 'Authorize.HabtmDbAcl');
```

Make sure if you need to alter settings for HabtmDbAcl, you pass those to
AclComponent ``$settings['habtm']``, and have it loaded before any Auth configuration.
```php
//in $components
public $components = array(
'Acl' => array('habtm' => array(
'userModel' => 'Users.User',
'groupAlias' => 'Group'
)),
'Auth' => array(
//your Auth settings
)
);
```
22 changes: 22 additions & 0 deletions Test/Case/AllAuthorizeTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?php
/**
* All tests for this plugin
*
* @package Cake.Test.Case.Controller.Component.Auth
*/
class AllAuthorizeTest extends CakeTestCase {

/**
* Suite define the tests for this suite
*
* @return CakeTestSuite
*/
public static function suite() {
$suite = new CakeTestSuite('All Authorize test');

$path = CakePlugin::path('Authorize') . 'Test' . DS . 'Case' . DS;
$suite->addTestDirectoryRecursive($path);

return $suite;
}
}
36 changes: 27 additions & 9 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,29 @@
{
"name": "ceeram/Authorize",
"type": "cakephp-plugin",
"description": "CakePHP authorize classes for AuthComponent.",
"homepage": "http://github.com/ceeram/Authorize",
"license": "MIT",
"require": {
"php": ">=5.3.0",
"composer/installers": "*"
}
"name": "friendsofcake/authorize",
"type": "cakephp-plugin",
"description": "CakePHP plugin with authorization classes for AuthComponent.",
"keywords":[
"cakephp",
"authorize"
],
"homepage": "http://github.com/FriendsOfCake/Authorize",
"authors":[
{
"name":"Ceeram",
"role":"Author"
}
],
"license": "MIT",
"support":{
"source":"https://github.com/FriendsOfCake/Authorize",
"issues":"https://github.com/FriendsOfCake/Authorize/issues",
"irc":"irc://irc.freenode.org/friendsofcake"
},
"require": {
"php": ">=5.3.0",
"composer/installers": "*"
},
"extra": {
"installer-name": "Authorize"
}
}
109 changes: 0 additions & 109 deletions readme.textile

This file was deleted.

0 comments on commit 5452317

Please sign in to comment.