-
Notifications
You must be signed in to change notification settings - Fork 630
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 #471 from phalcon/2.0.x
2.0.7
- Loading branch information
Showing
362 changed files
with
36,658 additions
and
6 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
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
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,45 @@ | ||
<?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,145 @@ | ||
<?php | ||
|
||
namespace Phalcon; | ||
|
||
/** | ||
* Phalcon\Config | ||
* Phalcon\Config is designed to simplify the access to, and the use of, configuration data within applications. | ||
* It provides a nested object property based user interface for accessing this configuration data within | ||
* application code. | ||
* <code> | ||
* $config = new \Phalcon\Config(array( | ||
* "database" => array( | ||
* "adapter" => "Mysql", | ||
* "host" => "localhost", | ||
* "username" => "scott", | ||
* "password" => "cheetah", | ||
* "dbname" => "test_db" | ||
* ), | ||
* "phalcon" => array( | ||
* "controllersDir" => "../app/controllers/", | ||
* "modelsDir" => "../app/models/", | ||
* "viewsDir" => "../app/views/" | ||
* ) | ||
* )); | ||
* </code> | ||
*/ | ||
class Config implements \ArrayAccess, \Countable | ||
{ | ||
|
||
/** | ||
* Phalcon\Config constructor | ||
* | ||
* @param array $arrayConfig | ||
*/ | ||
public function __construct($arrayConfig = null) {} | ||
|
||
/** | ||
* Allows to check whether an attribute is defined using the array-syntax | ||
* <code> | ||
* var_dump(isset($config['database'])); | ||
* </code> | ||
* | ||
* @param mixed $index | ||
* @return bool | ||
*/ | ||
public function offsetExists($index) {} | ||
|
||
/** | ||
* Gets an attribute from the configuration, if the attribute isn't defined returns null | ||
* If the value is exactly null or is not defined the default value will be used instead | ||
* <code> | ||
* echo $config->get('controllersDir', '../app/controllers/'); | ||
* </code> | ||
* | ||
* @param mixed $index | ||
* @param mixed $defaultValue | ||
*/ | ||
public function get($index, $defaultValue = null) {} | ||
|
||
/** | ||
* Gets an attribute using the array-syntax | ||
* <code> | ||
* print_r($config['database']); | ||
* </code> | ||
* | ||
* @param mixed $index | ||
* @return string | ||
*/ | ||
public function offsetGet($index) {} | ||
|
||
/** | ||
* Sets an attribute using the array-syntax | ||
* <code> | ||
* $config['database'] = array('type' => 'Sqlite'); | ||
* </code> | ||
* | ||
* @param mixed $index | ||
* @param mixed $value | ||
*/ | ||
public function offsetSet($index, $value) {} | ||
|
||
/** | ||
* Unsets an attribute using the array-syntax | ||
* <code> | ||
* unset($config['database']); | ||
* </code> | ||
* | ||
* @param mixed $index | ||
*/ | ||
public function offsetUnset($index) {} | ||
|
||
/** | ||
* Merges a configuration into the current one | ||
* <code> | ||
* $appConfig = new \Phalcon\Config(array('database' => array('host' => 'localhost'))); | ||
* $globalConfig->merge($config2); | ||
* </code> | ||
* | ||
* @param mixed $config | ||
* @return Config | ||
*/ | ||
public function merge(Config $config) {} | ||
|
||
/** | ||
* Converts recursively the object to an array | ||
* <code> | ||
* print_r($config->toArray()); | ||
* </code> | ||
* | ||
* @return array | ||
*/ | ||
public function toArray() {} | ||
|
||
/** | ||
* Returns the count of properties set in the config | ||
* <code> | ||
* print count($config); | ||
* </code> | ||
* or | ||
* <code> | ||
* print $config->count(); | ||
* </code> | ||
* | ||
* @return int | ||
*/ | ||
public function count() {} | ||
|
||
/** | ||
* Restores the state of a Phalcon\Config object | ||
* | ||
* @param array $data | ||
* @return Config | ||
*/ | ||
public static function __set_state($data) {} | ||
|
||
/** | ||
* Helper method for merge configs (forwarding nested config instance) | ||
* | ||
* @param Config $config | ||
* @param Config $instance = null | ||
* @return Config config | ||
*/ | ||
protected final function _merge(Config $config, $instance = null) {} | ||
|
||
} |
Oops, something went wrong.