Skip to content

Commit

Permalink
Regenerated API rst
Browse files Browse the repository at this point in the history
  • Loading branch information
niden committed Mar 17, 2017
1 parent 572bdf1 commit b398077
Show file tree
Hide file tree
Showing 2,255 changed files with 94,649 additions and 53,960 deletions.
206 changes: 124 additions & 82 deletions en/api/Phalcon_Acl_Adapter_Memory.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,58 +10,68 @@ Class **Phalcon\\Acl\\Adapter\\Memory**

:raw-html:`<a href="https://github.com/phalcon/cphalcon/blob/master/phalcon/acl/adapter/memory.zep" class="btn btn-default btn-sm">Source on GitHub</a>`

Manages ACL lists in memory
Manages ACL lists in memory

.. code-block:: php
<?php
$acl = new \Phalcon\Acl\Adapter\Memory();
$acl->setDefaultAction(Phalcon\Acl::DENY);
//Register roles
$roles = array(
'users' => new \Phalcon\Acl\Role('Users'),
'guests' => new \Phalcon\Acl\Role('Guests')
$acl->setDefaultAction(
\Phalcon\Acl::DENY
);
// Register roles
$roles = [
"users" => new \Phalcon\Acl\Role("Users"),
"guests" => new \Phalcon\Acl\Role("Guests"),
];
foreach ($roles as $role) {
$acl->addRole($role);
$acl->addRole($role);
}
//Private area resources
$privateResources = array(
'companies' => array('index', 'search', 'new', 'edit', 'save', 'create', 'delete'),
'products' => array('index', 'search', 'new', 'edit', 'save', 'create', 'delete'),
'invoices' => array('index', 'profile')
);
foreach ($privateResources as $resource => $actions) {
$acl->addResource(new Phalcon\Acl\Resource($resource), $actions);
// Private area resources
$privateResources = [
"companies" => ["index", "search", "new", "edit", "save", "create", "delete"],
"products" => ["index", "search", "new", "edit", "save", "create", "delete"],
"invoices" => ["index", "profile"],
];
foreach ($privateResources as $resourceName => $actions) {
$acl->addResource(
new \Phalcon\Acl\Resource($resourceName),
$actions
);
}
//Public area resources
$publicResources = array(
'index' => array('index'),
'about' => array('index'),
'session' => array('index', 'register', 'start', 'end'),
'contact' => array('index', 'send')
);
foreach ($publicResources as $resource => $actions) {
$acl->addResource(new Phalcon\Acl\Resource($resource), $actions);
// Public area resources
$publicResources = [
"index" => ["index"],
"about" => ["index"],
"session" => ["index", "register", "start", "end"],
"contact" => ["index", "send"],
];
foreach ($publicResources as $resourceName => $actions) {
$acl->addResource(
new \Phalcon\Acl\Resource($resourceName),
$actions
);
}
//Grant access to public areas to both users and guests
// Grant access to public areas to both users and guests
foreach ($roles as $role){
foreach ($publicResources as $resource => $actions) {
$acl->allow($role->getName(), $resource, '*');
}
foreach ($publicResources as $resource => $actions) {
$acl->allow($role->getName(), $resource, "*");
}
}
//Grant access to private area to role Users
// Grant access to private area to role Users
foreach ($privateResources as $resource => $actions) {
foreach ($actions as $action) {
$acl->allow('Users', $resource, $action);
}
foreach ($actions as $action) {
$acl->allow("Users", $resource, $action);
}
}
Expand All @@ -77,14 +87,19 @@ Phalcon\\Acl\\Adapter\\Memory constructor

public **addRole** (*RoleInterface* | *string* $role, [*array* | *string* $accessInherits])

Adds a role to the ACL list. Second parameter allows inheriting access data from other existing role Example:
Adds a role to the ACL list. Second parameter allows inheriting access data from other existing role
Example:

.. code-block:: php
<?php
$acl->addRole(new Phalcon\Acl\Role('administrator'), 'consultant');
$acl->addRole('administrator', 'consultant');
$acl->addRole(
new Phalcon\Acl\Role("administrator"),
"consultant"
);
$acl->addRole("administrator", "consultant");
Expand All @@ -109,19 +124,39 @@ Check whether resource exist in the resources list

public **addResource** (:doc:`Phalcon\\Acl\\Resource <Phalcon_Acl_Resource>` | *string* $resourceValue, *array* | *string* $accessList)

Adds a resource to the ACL list Access names can be a particular action, by example search, update, delete, etc or a list of them Example:
Adds a resource to the ACL list
Access names can be a particular action, by example
search, update, delete, etc or a list of them
Example:

.. code-block:: php
<?php
//Add a resource to the the list allowing access to an action
$acl->addResource(new Phalcon\Acl\Resource('customers'), 'search');
$acl->addResource('customers', 'search');
//Add a resource with an access list
$acl->addResource(new Phalcon\Acl\Resource('customers'), array('create', 'search'));
$acl->addResource('customers', array('create', 'search'));
// Add a resource to the the list allowing access to an action
$acl->addResource(
new Phalcon\Acl\Resource("customers"),
"search"
);
$acl->addResource("customers", "search");
// Add a resource with an access list
$acl->addResource(
new Phalcon\Acl\Resource("customers"),
[
"create",
"search",
]
);
$acl->addResource(
"customers",
[
"create",
"search",
]
);
Expand All @@ -146,76 +181,83 @@ Checks if a role has access to a resource

public **allow** (*mixed* $roleName, *mixed* $resourceName, *mixed* $access, [*mixed* $func])

Allow access to a role on a resource You can use '*' as wildcard Example:
Allow access to a role on a resource
You can use '*' as wildcard
Example:

.. code-block:: php
<?php
//Allow access to guests to search on customers
$acl->allow('guests', 'customers', 'search');
//Allow access to guests to search or create on customers
$acl->allow('guests', 'customers', array('search', 'create'));
//Allow access to any role to browse on products
$acl->allow('*', 'products', 'browse');
//Allow access to any role to browse on any resource
$acl->allow('*', '*', 'browse');
//Allow access to guests to search on customers
$acl->allow("guests", "customers", "search");
//Allow access to guests to search or create on customers
$acl->allow("guests", "customers", ["search", "create"]);
//Allow access to any role to browse on products
$acl->allow("*", "products", "browse");
//Allow access to any role to browse on any resource
$acl->allow("*", "*", "browse");
public **deny** (*mixed* $roleName, *mixed* $resourceName, *mixed* $access, [*mixed* $func])

Deny access to a role on a resource You can use '*' as wildcard Example:
Deny access to a role on a resource
You can use '*' as wildcard
Example:

.. code-block:: php
<?php
//Deny access to guests to search on customers
$acl->deny('guests', 'customers', 'search');
//Deny access to guests to search or create on customers
$acl->deny('guests', 'customers', array('search', 'create'));
//Deny access to any role to browse on products
$acl->deny('*', 'products', 'browse');
//Deny access to any role to browse on any resource
$acl->deny('*', '*', 'browse');
//Deny access to guests to search on customers
$acl->deny("guests", "customers", "search");
//Deny access to guests to search or create on customers
$acl->deny("guests", "customers", ["search", "create"]);
//Deny access to any role to browse on products
$acl->deny("*", "products", "browse");
//Deny access to any role to browse on any resource
$acl->deny("*", "*", "browse");
public **isAllowed** (*mixed* $roleName, *mixed* $resourceName, *mixed* $access, [*array* $parameters])
Check whether a role is allowed to access an action from a resource
public **isAllowed** (*RoleInterface* | *RoleAware* | *string* $roleName, *ResourceInterface* | *ResourceAware* | *string* $resourceName, *mixed* $access, [*array* $parameters])

Check whether a role is allowed to access an action from a resource

.. code-block:: php
<?php
//Does andres have access to the customers resource to create?
$acl->isAllowed('andres', 'Products', 'create');
//Do guests have access to any resource to edit?
$acl->isAllowed('guests', '*', 'edit');
//Does andres have access to the customers resource to create?
$acl->isAllowed("andres", "Products", "create");
//Do guests have access to any resource to edit?
$acl->isAllowed("guests", "*", "edit");
public **setNoArgumentsDefaultAction** (*mixed* $defaultAccess)

Sets the default access level (Phalcon\\Acl::ALLOW or Phalcon\\Acl::DENY) for no arguments provided in isAllowed action if there exists func for accessKey
Sets the default access level (Phalcon\\Acl::ALLOW or Phalcon\\Acl::DENY)
for no arguments provided in isAllowed action if there exists func for
accessKey



public **getNoArgumentsDefaultAction** ()

Returns the default ACL access level for no arguments provided in isAllowed action if there exists func for accessKey
Returns the default ACL access level for no arguments provided in
isAllowed action if there exists func for accessKey



Expand Down
8 changes: 5 additions & 3 deletions en/api/Phalcon_Annotations_Adapter_Apc.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,15 @@ Class **Phalcon\\Annotations\\Adapter\\Apc**

:raw-html:`<a href="https://github.com/phalcon/cphalcon/blob/master/phalcon/annotations/adapter/apc.zep" class="btn btn-default btn-sm">Source on GitHub</a>`

Stores the parsed annotations in APC. This adapter is suitable for production
Stores the parsed annotations in APC. This adapter is suitable for production

.. code-block:: php
<?php
$annotations = new \Phalcon\Annotations\Adapter\Apc();
use Phalcon\Annotations\Adapter\Apc;
$annotations = new Apc();
Expand All @@ -29,7 +31,7 @@ Phalcon\\Annotations\\Adapter\\Apc constructor



public :doc:`Phalcon\\Annotations\\Reflection <Phalcon_Annotations_Reflection>` **read** (*string* $key)
public **read** (*mixed* $key)

Reads parsed annotations from APC

Expand Down
12 changes: 8 additions & 4 deletions en/api/Phalcon_Annotations_Adapter_Files.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,19 @@ Class **Phalcon\\Annotations\\Adapter\\Files**

:raw-html:`<a href="https://github.com/phalcon/cphalcon/blob/master/phalcon/annotations/adapter/files.zep" class="btn btn-default btn-sm">Source on GitHub</a>`

Stores the parsed annotations in files. This adapter is suitable for production
Stores the parsed annotations in files. This adapter is suitable for production

.. code-block:: php
<?php
use Phalcon\Annotations\Adapter\Files;
$annotations = new Files(['annotationsDir' => 'app/cache/annotations/']);
use Phalcon\Annotations\Adapter\Files;
$annotations = new Files(
[
"annotationsDir" => "app/cache/annotations/",
]
);
Expand Down
2 changes: 1 addition & 1 deletion en/api/Phalcon_Annotations_Adapter_Memory.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Stores the parsed annotations in memory. This adapter is the suitable developmen
Methods
-------

public :doc:`Phalcon\\Annotations\\Reflection <Phalcon_Annotations_Reflection>` **read** (*string* $key)
public **read** (*mixed* $key)

Reads parsed annotations from memory

Expand Down
4 changes: 2 additions & 2 deletions en/api/Phalcon_Annotations_Adapter_Xcache.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ Class **Phalcon\\Annotations\\Adapter\\Xcache**

:raw-html:`<a href="https://github.com/phalcon/cphalcon/blob/master/phalcon/annotations/adapter/xcache.zep" class="btn btn-default btn-sm">Source on GitHub</a>`

Stores the parsed annotations to XCache. This adapter is suitable for production
Stores the parsed annotations to XCache. This adapter is suitable for production

.. code-block:: php
<?php
$annotations = new \Phalcon\Annotations\Adapter\Xcache();
$annotations = new \Phalcon\Annotations\Adapter\Xcache();
Expand Down
Loading

0 comments on commit b398077

Please sign in to comment.