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

Commit 5452317

Browse files
committed
cleanig up for transfer to friendsofcake
1 parent a79bb9d commit 5452317

File tree

8 files changed

+205
-136
lines changed

8 files changed

+205
-136
lines changed

.travis.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
language: php
2+
3+
php:
4+
- 5.3
5+
- 5.4
6+
- 5.5
7+
8+
env:
9+
global:
10+
- REPO_NAME=Authorize
11+
- PLUGIN_NAME=Authorize
12+
- REQUIRE=""
13+
14+
matrix:
15+
- DB=mysql CAKE_VERSION=master
16+
- DB=mysql CAKE_VERSION=2.5
17+
18+
matrix:
19+
include:
20+
- php: 5.4
21+
env:
22+
- DB=mysql CAKE_VERSION=master COVERALLS=1
23+
- php: 5.4
24+
env:
25+
- DB=mysql CAKE_VERSION=master PHPCS=1
26+
27+
before_script:
28+
- cd ..
29+
- git clone git://github.com/cakephp/cakephp.git --branch $CAKE_VERSION --depth 1
30+
- cd cakephp/app
31+
- git clone https://github.com/FriendsOfCake/travis.git
32+
- ./travis/before_script.sh
33+
34+
script:
35+
- ./travis/script.sh
36+
37+
after_success:
38+
- ./travis/after_success.sh
39+
40+
notifications:
41+
email: false

Controller/Component/Acl/HabtmDbAcl.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
* HabtmDbAcl implements an ACL control system in the database like DbAcl with
66
* User habtm Group checks
77
*
8+
* Licensed under The MIT License
9+
* For full copyright and license information, please see the LICENSE.txt
810
*/
911
class HabtmDbAcl extends DbAcl {
1012

Controller/Component/Auth/AclAuthorize.php

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,4 @@
11
<?php
2-
/**
3-
* PHP 5
4-
*
5-
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
6-
* Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
7-
*
8-
* Licensed under The MIT License
9-
* Redistributions of files must retain the above copyright notice.
10-
*
11-
* @copyright Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
12-
* @link http://cakephp.org CakePHP(tm) Project
13-
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
14-
*/
15-
162
App::uses('BaseAuthorize', 'Controller/Component/Auth');
173
App::uses('Router', 'Routing');
184

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

LICENSE.txt

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
The MIT License (MIT)
2+
3+
Copyright (c) 2013 M. Ypes, aka Ceeram
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in
13+
all copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21+
THE SOFTWARE.

README.md

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
# Authorize plugin
2+
3+
Plugin containing some authorize classes for AuthComponent.
4+
5+
Current classes:
6+
- AclAuthorize, row based Acl. AuthComponent adapter, to use together with AclBehavior created acos
7+
- HabtmDbAcl. AclComponent adapter, for User habtm Group Acl. (for database acl only)
8+
9+
## Requirements
10+
11+
- PHP 5.2.8
12+
- CakePHP 2.x
13+
14+
## Installation
15+
16+
_[Manual]_
17+
18+
- Download this: http://github.com/FriendsOfCake/Authorize/zipball/master
19+
- Unzip that download.
20+
- Copy the resulting folder to app/Plugin
21+
- Rename the folder you just copied to Authorize
22+
23+
_[GIT Submodule]_
24+
25+
In your app directory type:
26+
```
27+
git submodule add git://github.com/FriedsOfCake/Authorize.git Plugin/Authorize
28+
git submodule init
29+
git submodule update
30+
```
31+
32+
_[GIT Clone]_
33+
34+
In your plugin directory type
35+
```
36+
git clone git://github.com/FriendsOfCake/Authorize.git Authorize
37+
```
38+
39+
## Usage
40+
41+
In `app/Config/bootstrap.php` add: `CakePlugin::load('Authorize');`
42+
43+
## Configuration AclAuthorize:
44+
45+
Setup the authorize class
46+
47+
Example:
48+
```php
49+
//in $components
50+
public $components = array(
51+
'Auth' => array(
52+
'authorize' => array(
53+
'Controller',
54+
'Authorize.Acl' => array('actionPath' => 'Models/')
55+
)
56+
)
57+
);
58+
//Or in beforeFilter()
59+
$this->Auth->authorize = array(
60+
'Controller',
61+
'Authorize.Acl' => array('actionPath' => 'Models/')
62+
);
63+
```
64+
In the above example `ControllerAuthorize` is checked first. If your `Controller::isAuthorized()`
65+
returns true on admin routing, AclAuthorize will only be checked for non-admin urls.
66+
Also you need to set `actionPath` in a similar way which is used with Actions- and CrudAuthorize.
67+
68+
## Configuration HabtmDbAcl:
69+
70+
Setup the HabtmDbAcl adapter
71+
72+
in app/Config/core.php
73+
```php
74+
Configure::write('Acl.classname', 'Authorize.HabtmDbAcl');
75+
```
76+
77+
Make sure if you need to alter settings for HabtmDbAcl, you pass those to
78+
AclComponent ``$settings['habtm']``, and have it loaded before any Auth configuration.
79+
```php
80+
//in $components
81+
public $components = array(
82+
'Acl' => array('habtm' => array(
83+
'userModel' => 'Users.User',
84+
'groupAlias' => 'Group'
85+
)),
86+
'Auth' => array(
87+
//your Auth settings
88+
)
89+
);
90+
```

Test/Case/AllAuthorizeTest.php

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<?php
2+
/**
3+
* All tests for this plugin
4+
*
5+
* @package Cake.Test.Case.Controller.Component.Auth
6+
*/
7+
class AllAuthorizeTest extends CakeTestCase {
8+
9+
/**
10+
* Suite define the tests for this suite
11+
*
12+
* @return CakeTestSuite
13+
*/
14+
public static function suite() {
15+
$suite = new CakeTestSuite('All Authorize test');
16+
17+
$path = CakePlugin::path('Authorize') . 'Test' . DS . 'Case' . DS;
18+
$suite->addTestDirectoryRecursive($path);
19+
20+
return $suite;
21+
}
22+
}

composer.json

Lines changed: 27 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,29 @@
11
{
2-
"name": "ceeram/Authorize",
3-
"type": "cakephp-plugin",
4-
"description": "CakePHP authorize classes for AuthComponent.",
5-
"homepage": "http://github.com/ceeram/Authorize",
6-
"license": "MIT",
7-
"require": {
8-
"php": ">=5.3.0",
9-
"composer/installers": "*"
10-
}
2+
"name": "friendsofcake/authorize",
3+
"type": "cakephp-plugin",
4+
"description": "CakePHP plugin with authorization classes for AuthComponent.",
5+
"keywords":[
6+
"cakephp",
7+
"authorize"
8+
],
9+
"homepage": "http://github.com/FriendsOfCake/Authorize",
10+
"authors":[
11+
{
12+
"name":"Ceeram",
13+
"role":"Author"
14+
}
15+
],
16+
"license": "MIT",
17+
"support":{
18+
"source":"https://github.com/FriendsOfCake/Authorize",
19+
"issues":"https://github.com/FriendsOfCake/Authorize/issues",
20+
"irc":"irc://irc.freenode.org/friendsofcake"
21+
},
22+
"require": {
23+
"php": ">=5.3.0",
24+
"composer/installers": "*"
25+
},
26+
"extra": {
27+
"installer-name": "Authorize"
28+
}
1129
}

readme.textile

Lines changed: 0 additions & 109 deletions
This file was deleted.

0 commit comments

Comments
 (0)