Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from phalcon/master
Merge phalcon-devtools
- Loading branch information
Showing
559 changed files
with
56,108 additions
and
3,566 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,5 +13,10 @@ | |
], | ||
"require": { | ||
"php": ">=5.3.6" | ||
}, | ||
"autoload": { | ||
"psr-0" : { | ||
"Phalcon" : "scripts/" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
<?php | ||
|
||
namespace Phalcon { | ||
|
||
/** | ||
* Phalcon\Acl | ||
* | ||
* This component allows to manage ACL lists. An access control list (ACL) is a list | ||
* of permissions attached to an object. An ACL specifies which users or system processes | ||
* are granted access to objects, as well as what operations are allowed on given objects. | ||
* | ||
*<code> | ||
* | ||
* $acl = new Phalcon\Acl\Adapter\Memory(); | ||
* | ||
* //Default action is deny access | ||
* $acl->setDefaultAction(Phalcon\Acl::DENY); | ||
* | ||
* //Create some roles | ||
* $roleAdmins = new Phalcon\Acl\Role('Administrators', 'Super-User role'); | ||
* $roleGuests = new Phalcon\Acl\Role('Guests'); | ||
* | ||
* //Add "Guests" role to acl | ||
* $acl->addRole($roleGuests); | ||
* | ||
* //Add "Designers" role to acl | ||
* $acl->addRole('Designers'); | ||
* | ||
* //Define the "Customers" resource | ||
* $customersResource = new Phalcon\Acl\Resource('Customers', 'Customers management'); | ||
* | ||
* //Add "customers" resource with a couple of operations | ||
* $acl->addResource($customersResource, 'search'); | ||
* $acl->addResource($customersResource, array('create', 'update')); | ||
* | ||
* //Set access level for roles into resources | ||
* $acl->allow('Guests', 'Customers', 'search'); | ||
* $acl->allow('Guests', 'Customers', 'create'); | ||
* $acl->deny('Guests', 'Customers', 'update'); | ||
* | ||
* //Check whether role has access to the operations | ||
* $acl->isAllowed('Guests', 'Customers', 'edit'); //Returns 0 | ||
* $acl->isAllowed('Guests', 'Customers', 'search'); //Returns 1 | ||
* $acl->isAllowed('Guests', 'Customers', 'create'); //Returns 1 | ||
* | ||
*</code> | ||
*/ | ||
|
||
abstract class Acl { | ||
|
||
const ALLOW = 1; | ||
|
||
const DENY = 0; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
<?php | ||
|
||
namespace Phalcon\Acl { | ||
|
||
/** | ||
* Phalcon\Acl\Adapter | ||
* | ||
* Adapter for Phalcon\Acl adapters | ||
*/ | ||
|
||
abstract class Adapter implements \Phalcon\Events\EventsAwareInterface { | ||
|
||
protected $_eventsManager; | ||
|
||
protected $_defaultAccess; | ||
|
||
protected $_accessGranted; | ||
|
||
protected $_activeRole; | ||
|
||
protected $_activeResource; | ||
|
||
protected $_activeAccess; | ||
|
||
/** | ||
* Sets the events manager | ||
* | ||
* @param \Phalcon\Events\ManagerInterface $eventsManager | ||
*/ | ||
public function setEventsManager($eventsManager){ } | ||
|
||
|
||
/** | ||
* Returns the internal event manager | ||
* | ||
* @return \Phalcon\Events\ManagerInterface | ||
*/ | ||
public function getEventsManager(){ } | ||
|
||
|
||
/** | ||
* Sets the default access level (Phalcon\Acl::ALLOW or \Phalcon\Acl::DENY) | ||
* | ||
* @param int $defaultAccess | ||
*/ | ||
public function setDefaultAction($defaultAccess){ } | ||
|
||
|
||
/** | ||
* Returns the default ACL access level | ||
* | ||
* @return int | ||
*/ | ||
public function getDefaultAction(){ } | ||
|
||
|
||
/** | ||
* Returns the role which the list is checking if it's allowed to certain resource/access | ||
* | ||
* @return string | ||
*/ | ||
public function getActiveRole(){ } | ||
|
||
|
||
/** | ||
* Returns the resource which the list is checking if some role can access it | ||
* | ||
* @return string | ||
*/ | ||
public function getActiveResource(){ } | ||
|
||
|
||
/** | ||
* Returns the access which the list is checking if some role can access it | ||
* | ||
* @return string | ||
*/ | ||
public function getActiveAccess(){ } | ||
|
||
} | ||
} |
Oops, something went wrong.