diff --git a/ext/phalcon/acl.zep.c b/ext/phalcon/acl.zep.c deleted file mode 100644 index 40de70578c0..00000000000 --- a/ext/phalcon/acl.zep.c +++ /dev/null @@ -1,83 +0,0 @@ - -#ifdef HAVE_CONFIG_H -#include "../ext_config.h" -#endif - -#include -#include "../php_ext.h" -#include "../ext.h" - -#include -#include -#include - -#include "kernel/main.h" - - -/** - * This file is part of the Phalcon Framework. - * - * (c) Phalcon Team - * - * For the full copyright and license information, please view the LICENSE.txt - * file that was distributed with this source code. - */ -/** - * 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. - * - * - * use Phalcon\Acl; - * use Phalcon\Acl\Operation; - * use Phalcon\Acl\Subject; - * use Phalcon\Acl\Adapter\Memory; - * - * $acl = new Memory(); - * - * // Default action is deny access - * $acl->setDefaultAction(Acl::DENY); - * - * // Create some operations - * $adminsOperation = new Operation("Administrators", "Super-User role"); - * $guestsOperation = new Operation("Guests"); - * - * // Add "Guests" operation to acl - * $acl->addOperation($roleGuests); - * - * // Add "Designers" operation to acl - * $acl->addOperation("Designers"); - * - * // Define the "Customers" subject - * $customersSubject = new Subject("Customers", "Customers management"); - * - * // Add "customers" subject with a couple of operations - * $acl->addSubject($customersSubject, "search"); - * $acl->addSubject($customersSubject, ["create", "update"]); - * - * // Set access level for operations into subjects - * $acl->allow($guestsOperation->getName(), "Customers", "search"); - * $acl->allow("Guests", "Customers", "create"); - * $acl->deny($guestsOperation->getName(), "Customers", "update"); - * - * // Check whether operation has access to the operations - * $acl->isAllowed("Guests", "Customers", "edit"); // Returns 0 - * $acl->isAllowed($guestsOperation->getName(), "Customers", "search"); // Returns 1 - * $acl->isAllowed($guestsOperation->getName(), "Customers", "create"); // Returns 1 - * - */ -ZEPHIR_INIT_CLASS(Phalcon_Acl) { - - ZEPHIR_REGISTER_CLASS(Phalcon, Acl, phalcon, acl, NULL, ZEND_ACC_EXPLICIT_ABSTRACT_CLASS); - - zephir_declare_class_constant_long(phalcon_acl_ce, SL("ALLOW"), 1); - - zephir_declare_class_constant_long(phalcon_acl_ce, SL("DENY"), 0); - - return SUCCESS; - -} - diff --git a/ext/phalcon/acl.zep.h b/ext/phalcon/acl.zep.h deleted file mode 100644 index 927213d70b8..00000000000 --- a/ext/phalcon/acl.zep.h +++ /dev/null @@ -1,5 +0,0 @@ - -extern zend_class_entry *phalcon_acl_ce; - -ZEPHIR_INIT_CLASS(Phalcon_Acl); - diff --git a/ext/phalcon/acl/adapter.zep.c b/ext/phalcon/acl/adapter.zep.c deleted file mode 100644 index 307f07450b6..00000000000 --- a/ext/phalcon/acl/adapter.zep.c +++ /dev/null @@ -1,189 +0,0 @@ - -#ifdef HAVE_CONFIG_H -#include "../../ext_config.h" -#endif - -#include -#include "../../php_ext.h" -#include "../../ext.h" - -#include -#include -#include - -#include "kernel/main.h" -#include "kernel/object.h" -#include "kernel/memory.h" -#include "kernel/operators.h" - - -/** - * This file is part of the Phalcon Framework. - * - * (c) Phalcon Team - * - * For the full copyright and license information, please view the LICENSE.txt - * file that was distributed with this source code. - */ -/** - * Phalcon\Acl\Adapter - * - * Adapter for Phalcon\Acl adapters - */ -ZEPHIR_INIT_CLASS(Phalcon_Acl_Adapter) { - - ZEPHIR_REGISTER_CLASS(Phalcon\\Acl, Adapter, phalcon, acl_adapter, phalcon_acl_adapter_method_entry, ZEND_ACC_EXPLICIT_ABSTRACT_CLASS); - - /** - * Active access which the list is checking if some role can access it - * - * @var string - */ - zend_declare_property_null(phalcon_acl_adapter_ce, SL("activeAccess"), ZEND_ACC_PROTECTED TSRMLS_CC); - - /** - * Access Granted - * - * @var bool - */ - zend_declare_property_bool(phalcon_acl_adapter_ce, SL("accessGranted"), 0, ZEND_ACC_PROTECTED TSRMLS_CC); - - /** - * Role which the list is checking if it's allowed to certain - * component/access - * - * @var string - */ - zend_declare_property_null(phalcon_acl_adapter_ce, SL("activeRole"), ZEND_ACC_PROTECTED TSRMLS_CC); - - /** - * Component which the list is checking if some role can access it - * - * @var string - */ - zend_declare_property_null(phalcon_acl_adapter_ce, SL("activeComponent"), ZEND_ACC_PROTECTED TSRMLS_CC); - - /** - * Default access - * - * @var bool - */ - zend_declare_property_bool(phalcon_acl_adapter_ce, SL("defaultAccess"), 0, ZEND_ACC_PROTECTED TSRMLS_CC); - - /** - * Events manager - * - * @var mixed - */ - zend_declare_property_null(phalcon_acl_adapter_ce, SL("eventsManager"), ZEND_ACC_PROTECTED TSRMLS_CC); - - zend_class_implements(phalcon_acl_adapter_ce TSRMLS_CC, 1, phalcon_acl_adapterinterface_ce); - zend_class_implements(phalcon_acl_adapter_ce TSRMLS_CC, 1, phalcon_events_eventsawareinterface_ce); - return SUCCESS; - -} - -/** - * Active access which the list is checking if some role can access it - */ -PHP_METHOD(Phalcon_Acl_Adapter, getActiveAccess) { - - zval *this_ptr = getThis(); - - - RETURN_MEMBER(getThis(), "activeAccess"); - -} - -/** - * Role which the list is checking if it's allowed to certain - * - * - * component/access - * - */ -PHP_METHOD(Phalcon_Acl_Adapter, getActiveRole) { - - zval *this_ptr = getThis(); - - - RETURN_MEMBER(getThis(), "activeRole"); - -} - -/** - * Component which the list is checking if some role can access it - */ -PHP_METHOD(Phalcon_Acl_Adapter, getActiveComponent) { - - zval *this_ptr = getThis(); - - - RETURN_MEMBER(getThis(), "activeComponent"); - -} - -/** - * Returns the default ACL access level - */ -PHP_METHOD(Phalcon_Acl_Adapter, getDefaultAction) { - - zval *this_ptr = getThis(); - - - RETURN_MEMBER(getThis(), "defaultAccess"); - -} - -/** - * Returns the internal event manager - */ -PHP_METHOD(Phalcon_Acl_Adapter, getEventsManager) { - - zval *this_ptr = getThis(); - - - RETURN_MEMBER(getThis(), "eventsManager"); - -} - -/** - * Sets the default access level (Phalcon\Acl::ALLOW or Phalcon\Acl::DENY) - */ -PHP_METHOD(Phalcon_Acl_Adapter, setDefaultAction) { - - zval *defaultAccess_param = NULL, _0; - zend_long defaultAccess; - zval *this_ptr = getThis(); - - ZVAL_UNDEF(&_0); - - zephir_fetch_params(0, 1, 0, &defaultAccess_param); - - defaultAccess = zephir_get_intval(defaultAccess_param); - - - ZEPHIR_INIT_ZVAL_NREF(_0); - ZVAL_LONG(&_0, defaultAccess); - zephir_update_property_zval(this_ptr, SL("defaultAccess"), &_0); - -} - -/** - * Sets the events manager - */ -PHP_METHOD(Phalcon_Acl_Adapter, setEventsManager) { - - zval *eventsManager, eventsManager_sub; - zval *this_ptr = getThis(); - - ZVAL_UNDEF(&eventsManager_sub); - - zephir_fetch_params(0, 1, 0, &eventsManager); - - - - zephir_update_property_zval(this_ptr, SL("eventsManager"), eventsManager); - -} - diff --git a/ext/phalcon/acl/adapter.zep.h b/ext/phalcon/acl/adapter.zep.h deleted file mode 100644 index bc6c77a7605..00000000000 --- a/ext/phalcon/acl/adapter.zep.h +++ /dev/null @@ -1,70 +0,0 @@ - -extern zend_class_entry *phalcon_acl_adapter_ce; - -ZEPHIR_INIT_CLASS(Phalcon_Acl_Adapter); - -PHP_METHOD(Phalcon_Acl_Adapter, getActiveAccess); -PHP_METHOD(Phalcon_Acl_Adapter, getActiveRole); -PHP_METHOD(Phalcon_Acl_Adapter, getActiveComponent); -PHP_METHOD(Phalcon_Acl_Adapter, getDefaultAction); -PHP_METHOD(Phalcon_Acl_Adapter, getEventsManager); -PHP_METHOD(Phalcon_Acl_Adapter, setDefaultAction); -PHP_METHOD(Phalcon_Acl_Adapter, setEventsManager); - -#if PHP_VERSION_ID >= 70200 -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_acl_adapter_getactiveaccess, 0, 0, IS_STRING, 0) -#else -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_acl_adapter_getactiveaccess, 0, 0, IS_STRING, NULL, 0) -#endif -ZEND_END_ARG_INFO() - -#if PHP_VERSION_ID >= 70200 -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_acl_adapter_getactiverole, 0, 0, IS_STRING, 0) -#else -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_acl_adapter_getactiverole, 0, 0, IS_STRING, NULL, 0) -#endif -ZEND_END_ARG_INFO() - -#if PHP_VERSION_ID >= 70200 -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_acl_adapter_getactivecomponent, 0, 0, IS_STRING, 0) -#else -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_acl_adapter_getactivecomponent, 0, 0, IS_STRING, NULL, 0) -#endif -ZEND_END_ARG_INFO() - -#if PHP_VERSION_ID >= 70200 -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_acl_adapter_getdefaultaction, 0, 0, IS_LONG, 0) -#else -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_acl_adapter_getdefaultaction, 0, 0, IS_LONG, NULL, 0) -#endif -ZEND_END_ARG_INFO() - -#if PHP_VERSION_ID >= 70200 -ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_phalcon_acl_adapter_geteventsmanager, 0, 0, Phalcon\\Events\\ManagerInterface, 0) -#else -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_acl_adapter_geteventsmanager, 0, 0, IS_OBJECT, "Phalcon\\Events\\ManagerInterface", 0) -#endif -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_phalcon_acl_adapter_setdefaultaction, 0, 0, 1) -#if PHP_VERSION_ID >= 70200 - ZEND_ARG_TYPE_INFO(0, defaultAccess, IS_LONG, 0) -#else - ZEND_ARG_INFO(0, defaultAccess) -#endif -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_phalcon_acl_adapter_seteventsmanager, 0, 0, 1) - ZEND_ARG_OBJ_INFO(0, eventsManager, Phalcon\\Events\\ManagerInterface, 0) -ZEND_END_ARG_INFO() - -ZEPHIR_INIT_FUNCS(phalcon_acl_adapter_method_entry) { - PHP_ME(Phalcon_Acl_Adapter, getActiveAccess, arginfo_phalcon_acl_adapter_getactiveaccess, ZEND_ACC_PUBLIC) - PHP_ME(Phalcon_Acl_Adapter, getActiveRole, arginfo_phalcon_acl_adapter_getactiverole, ZEND_ACC_PUBLIC) - PHP_ME(Phalcon_Acl_Adapter, getActiveComponent, arginfo_phalcon_acl_adapter_getactivecomponent, ZEND_ACC_PUBLIC) - PHP_ME(Phalcon_Acl_Adapter, getDefaultAction, arginfo_phalcon_acl_adapter_getdefaultaction, ZEND_ACC_PUBLIC) - PHP_ME(Phalcon_Acl_Adapter, getEventsManager, arginfo_phalcon_acl_adapter_geteventsmanager, ZEND_ACC_PUBLIC) - PHP_ME(Phalcon_Acl_Adapter, setDefaultAction, arginfo_phalcon_acl_adapter_setdefaultaction, ZEND_ACC_PUBLIC) - PHP_ME(Phalcon_Acl_Adapter, setEventsManager, arginfo_phalcon_acl_adapter_seteventsmanager, ZEND_ACC_PUBLIC) - PHP_FE_END -}; diff --git a/ext/phalcon/acl/adapterinterface.zep.c b/ext/phalcon/acl/adapterinterface.zep.c deleted file mode 100644 index 71769e03bb4..00000000000 --- a/ext/phalcon/acl/adapterinterface.zep.c +++ /dev/null @@ -1,139 +0,0 @@ - -#ifdef HAVE_CONFIG_H -#include "../../ext_config.h" -#endif - -#include -#include "../../php_ext.h" -#include "../../ext.h" - -#include - -#include "kernel/main.h" - - -/** - * This file is part of the Phalcon Framework. - * - * (c) Phalcon Team - * - * For the full copyright and license information, please view the LICENSE.txt - * file that was distributed with this source code. - */ -/** - * Phalcon\Acl\AdapterInterface - * - * Interface for Phalcon\Acl adapters - */ -ZEPHIR_INIT_CLASS(Phalcon_Acl_AdapterInterface) { - - ZEPHIR_REGISTER_INTERFACE(Phalcon\\Acl, AdapterInterface, phalcon, acl_adapterinterface, phalcon_acl_adapterinterface_method_entry); - - return SUCCESS; - -} - -/** - * Do a role inherit from another existing role - */ -ZEPHIR_DOC_METHOD(Phalcon_Acl_AdapterInterface, addInherit); - -/** - * Adds a role to the ACL list. Second parameter lets to inherit access data - * from other existing role - */ -ZEPHIR_DOC_METHOD(Phalcon_Acl_AdapterInterface, addRole); - -/** - * Adds a component to the ACL list - * - * Access names can be a particular action, by example - * search, update, delete, etc or a list of them - */ -ZEPHIR_DOC_METHOD(Phalcon_Acl_AdapterInterface, addComponent); - -/** - * Adds access to components - */ -ZEPHIR_DOC_METHOD(Phalcon_Acl_AdapterInterface, addComponentAccess); - -/** - * Allow access to a role on a component - */ -ZEPHIR_DOC_METHOD(Phalcon_Acl_AdapterInterface, allow); - -/** - * Deny access to a role on a component - */ -ZEPHIR_DOC_METHOD(Phalcon_Acl_AdapterInterface, deny); - -/** - * Removes an access from a component - */ -ZEPHIR_DOC_METHOD(Phalcon_Acl_AdapterInterface, dropComponentAccess); - -/** - * Returns the access which the list is checking if some role can access it - */ -ZEPHIR_DOC_METHOD(Phalcon_Acl_AdapterInterface, getActiveAccess); - -/** - * Returns the role which the list is checking if it's allowed to certain - * component/access - */ -ZEPHIR_DOC_METHOD(Phalcon_Acl_AdapterInterface, getActiveRole); - -/** - * Returns the component which the list is checking if some role can access - * it - */ -ZEPHIR_DOC_METHOD(Phalcon_Acl_AdapterInterface, getActiveComponent); - -/** - * Returns the default ACL access level - */ -ZEPHIR_DOC_METHOD(Phalcon_Acl_AdapterInterface, getDefaultAction); - -/** - * Returns the default ACL access level for no arguments provided in - * isAllowed action if there exists func for accessKey - */ -ZEPHIR_DOC_METHOD(Phalcon_Acl_AdapterInterface, getNoArgumentsDefaultAction); - -/** - * Return an array with every role registered in the list - */ -ZEPHIR_DOC_METHOD(Phalcon_Acl_AdapterInterface, getRoles); - -/** - * Return an array with every component registered in the list - */ -ZEPHIR_DOC_METHOD(Phalcon_Acl_AdapterInterface, getComponents); - -/** - * Check whether a role is allowed to access an action from a component - */ -ZEPHIR_DOC_METHOD(Phalcon_Acl_AdapterInterface, isAllowed); - -/** - * Check whether component exist in the components list - */ -ZEPHIR_DOC_METHOD(Phalcon_Acl_AdapterInterface, isComponent); - -/** - * Check whether role exist in the roles list - */ -ZEPHIR_DOC_METHOD(Phalcon_Acl_AdapterInterface, isRole); - -/** - * Sets the default access level (Phalcon\Acl::ALLOW or Phalcon\Acl::DENY) - */ -ZEPHIR_DOC_METHOD(Phalcon_Acl_AdapterInterface, setDefaultAction); - -/** - * 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 - */ -ZEPHIR_DOC_METHOD(Phalcon_Acl_AdapterInterface, setNoArgumentsDefaultAction); - diff --git a/ext/phalcon/acl/adapterinterface.zep.h b/ext/phalcon/acl/adapterinterface.zep.h deleted file mode 100644 index 612fbfce480..00000000000 --- a/ext/phalcon/acl/adapterinterface.zep.h +++ /dev/null @@ -1,214 +0,0 @@ - -extern zend_class_entry *phalcon_acl_adapterinterface_ce; - -ZEPHIR_INIT_CLASS(Phalcon_Acl_AdapterInterface); - -#if PHP_VERSION_ID >= 70200 -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_acl_adapterinterface_addinherit, 0, 2, _IS_BOOL, 0) -#else -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_acl_adapterinterface_addinherit, 0, 2, _IS_BOOL, NULL, 0) -#endif -#if PHP_VERSION_ID >= 70200 - ZEND_ARG_TYPE_INFO(0, roleName, IS_STRING, 0) -#else - ZEND_ARG_INFO(0, roleName) -#endif - ZEND_ARG_INFO(0, roleToInherit) -ZEND_END_ARG_INFO() - -#if PHP_VERSION_ID >= 70200 -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_acl_adapterinterface_addrole, 0, 1, _IS_BOOL, 0) -#else -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_acl_adapterinterface_addrole, 0, 1, _IS_BOOL, NULL, 0) -#endif - ZEND_ARG_INFO(0, role) - ZEND_ARG_INFO(0, accessInherits) -ZEND_END_ARG_INFO() - -#if PHP_VERSION_ID >= 70200 -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_acl_adapterinterface_addcomponent, 0, 2, _IS_BOOL, 0) -#else -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_acl_adapterinterface_addcomponent, 0, 2, _IS_BOOL, NULL, 0) -#endif - ZEND_ARG_INFO(0, componentObject) - ZEND_ARG_INFO(0, accessList) -ZEND_END_ARG_INFO() - -#if PHP_VERSION_ID >= 70200 -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_acl_adapterinterface_addcomponentaccess, 0, 2, _IS_BOOL, 0) -#else -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_acl_adapterinterface_addcomponentaccess, 0, 2, _IS_BOOL, NULL, 0) -#endif -#if PHP_VERSION_ID >= 70200 - ZEND_ARG_TYPE_INFO(0, componentName, IS_STRING, 0) -#else - ZEND_ARG_INFO(0, componentName) -#endif - ZEND_ARG_INFO(0, accessList) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_phalcon_acl_adapterinterface_allow, 0, 0, 3) -#if PHP_VERSION_ID >= 70200 - ZEND_ARG_TYPE_INFO(0, roleName, IS_STRING, 0) -#else - ZEND_ARG_INFO(0, roleName) -#endif -#if PHP_VERSION_ID >= 70200 - ZEND_ARG_TYPE_INFO(0, componentName, IS_STRING, 0) -#else - ZEND_ARG_INFO(0, componentName) -#endif - ZEND_ARG_INFO(0, access) - ZEND_ARG_INFO(0, func) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_phalcon_acl_adapterinterface_deny, 0, 0, 3) -#if PHP_VERSION_ID >= 70200 - ZEND_ARG_TYPE_INFO(0, roleName, IS_STRING, 0) -#else - ZEND_ARG_INFO(0, roleName) -#endif -#if PHP_VERSION_ID >= 70200 - ZEND_ARG_TYPE_INFO(0, componentName, IS_STRING, 0) -#else - ZEND_ARG_INFO(0, componentName) -#endif - ZEND_ARG_INFO(0, access) - ZEND_ARG_INFO(0, func) -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_phalcon_acl_adapterinterface_dropcomponentaccess, 0, 0, 2) -#if PHP_VERSION_ID >= 70200 - ZEND_ARG_TYPE_INFO(0, componentName, IS_STRING, 0) -#else - ZEND_ARG_INFO(0, componentName) -#endif - ZEND_ARG_INFO(0, accessList) -ZEND_END_ARG_INFO() - -#if PHP_VERSION_ID >= 70200 -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_acl_adapterinterface_getactiveaccess, 0, 0, IS_STRING, 0) -#else -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_acl_adapterinterface_getactiveaccess, 0, 0, IS_STRING, NULL, 0) -#endif -ZEND_END_ARG_INFO() - -#if PHP_VERSION_ID >= 70200 -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_acl_adapterinterface_getactiverole, 0, 0, IS_STRING, 0) -#else -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_acl_adapterinterface_getactiverole, 0, 0, IS_STRING, NULL, 0) -#endif -ZEND_END_ARG_INFO() - -#if PHP_VERSION_ID >= 70200 -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_acl_adapterinterface_getactivecomponent, 0, 0, IS_STRING, 0) -#else -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_acl_adapterinterface_getactivecomponent, 0, 0, IS_STRING, NULL, 0) -#endif -ZEND_END_ARG_INFO() - -#if PHP_VERSION_ID >= 70200 -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_acl_adapterinterface_getdefaultaction, 0, 0, IS_LONG, 0) -#else -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_acl_adapterinterface_getdefaultaction, 0, 0, IS_LONG, NULL, 0) -#endif -ZEND_END_ARG_INFO() - -#if PHP_VERSION_ID >= 70200 -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_acl_adapterinterface_getnoargumentsdefaultaction, 0, 0, IS_LONG, 0) -#else -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_acl_adapterinterface_getnoargumentsdefaultaction, 0, 0, IS_LONG, NULL, 0) -#endif -ZEND_END_ARG_INFO() - -#if PHP_VERSION_ID >= 70200 -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_acl_adapterinterface_getroles, 0, 0, IS_ARRAY, 0) -#else -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_acl_adapterinterface_getroles, 0, 0, IS_ARRAY, NULL, 0) -#endif -ZEND_END_ARG_INFO() - -#if PHP_VERSION_ID >= 70200 -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_acl_adapterinterface_getcomponents, 0, 0, IS_ARRAY, 0) -#else -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_acl_adapterinterface_getcomponents, 0, 0, IS_ARRAY, NULL, 0) -#endif -ZEND_END_ARG_INFO() - -#if PHP_VERSION_ID >= 70200 -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_acl_adapterinterface_isallowed, 0, 3, _IS_BOOL, 0) -#else -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_acl_adapterinterface_isallowed, 0, 3, _IS_BOOL, NULL, 0) -#endif - ZEND_ARG_INFO(0, roleName) - ZEND_ARG_INFO(0, componentName) -#if PHP_VERSION_ID >= 70200 - ZEND_ARG_TYPE_INFO(0, access, IS_STRING, 0) -#else - ZEND_ARG_INFO(0, access) -#endif - ZEND_ARG_ARRAY_INFO(0, parameters, 1) -ZEND_END_ARG_INFO() - -#if PHP_VERSION_ID >= 70200 -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_acl_adapterinterface_iscomponent, 0, 1, _IS_BOOL, 0) -#else -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_acl_adapterinterface_iscomponent, 0, 1, _IS_BOOL, NULL, 0) -#endif -#if PHP_VERSION_ID >= 70200 - ZEND_ARG_TYPE_INFO(0, componentName, IS_STRING, 0) -#else - ZEND_ARG_INFO(0, componentName) -#endif -ZEND_END_ARG_INFO() - -#if PHP_VERSION_ID >= 70200 -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_acl_adapterinterface_isrole, 0, 1, _IS_BOOL, 0) -#else -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_phalcon_acl_adapterinterface_isrole, 0, 1, _IS_BOOL, NULL, 0) -#endif -#if PHP_VERSION_ID >= 70200 - ZEND_ARG_TYPE_INFO(0, roleName, IS_STRING, 0) -#else - ZEND_ARG_INFO(0, roleName) -#endif -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_phalcon_acl_adapterinterface_setdefaultaction, 0, 0, 1) -#if PHP_VERSION_ID >= 70200 - ZEND_ARG_TYPE_INFO(0, defaultAccess, IS_LONG, 0) -#else - ZEND_ARG_INFO(0, defaultAccess) -#endif -ZEND_END_ARG_INFO() - -ZEND_BEGIN_ARG_INFO_EX(arginfo_phalcon_acl_adapterinterface_setnoargumentsdefaultaction, 0, 0, 1) -#if PHP_VERSION_ID >= 70200 - ZEND_ARG_TYPE_INFO(0, defaultAccess, IS_LONG, 0) -#else - ZEND_ARG_INFO(0, defaultAccess) -#endif -ZEND_END_ARG_INFO() - -ZEPHIR_INIT_FUNCS(phalcon_acl_adapterinterface_method_entry) { - PHP_ABSTRACT_ME(Phalcon_Acl_AdapterInterface, addInherit, arginfo_phalcon_acl_adapterinterface_addinherit) - PHP_ABSTRACT_ME(Phalcon_Acl_AdapterInterface, addRole, arginfo_phalcon_acl_adapterinterface_addrole) - PHP_ABSTRACT_ME(Phalcon_Acl_AdapterInterface, addComponent, arginfo_phalcon_acl_adapterinterface_addcomponent) - PHP_ABSTRACT_ME(Phalcon_Acl_AdapterInterface, addComponentAccess, arginfo_phalcon_acl_adapterinterface_addcomponentaccess) - PHP_ABSTRACT_ME(Phalcon_Acl_AdapterInterface, allow, arginfo_phalcon_acl_adapterinterface_allow) - PHP_ABSTRACT_ME(Phalcon_Acl_AdapterInterface, deny, arginfo_phalcon_acl_adapterinterface_deny) - PHP_ABSTRACT_ME(Phalcon_Acl_AdapterInterface, dropComponentAccess, arginfo_phalcon_acl_adapterinterface_dropcomponentaccess) - PHP_ABSTRACT_ME(Phalcon_Acl_AdapterInterface, getActiveAccess, arginfo_phalcon_acl_adapterinterface_getactiveaccess) - PHP_ABSTRACT_ME(Phalcon_Acl_AdapterInterface, getActiveRole, arginfo_phalcon_acl_adapterinterface_getactiverole) - PHP_ABSTRACT_ME(Phalcon_Acl_AdapterInterface, getActiveComponent, arginfo_phalcon_acl_adapterinterface_getactivecomponent) - PHP_ABSTRACT_ME(Phalcon_Acl_AdapterInterface, getDefaultAction, arginfo_phalcon_acl_adapterinterface_getdefaultaction) - PHP_ABSTRACT_ME(Phalcon_Acl_AdapterInterface, getNoArgumentsDefaultAction, arginfo_phalcon_acl_adapterinterface_getnoargumentsdefaultaction) - PHP_ABSTRACT_ME(Phalcon_Acl_AdapterInterface, getRoles, arginfo_phalcon_acl_adapterinterface_getroles) - PHP_ABSTRACT_ME(Phalcon_Acl_AdapterInterface, getComponents, arginfo_phalcon_acl_adapterinterface_getcomponents) - PHP_ABSTRACT_ME(Phalcon_Acl_AdapterInterface, isAllowed, arginfo_phalcon_acl_adapterinterface_isallowed) - PHP_ABSTRACT_ME(Phalcon_Acl_AdapterInterface, isComponent, arginfo_phalcon_acl_adapterinterface_iscomponent) - PHP_ABSTRACT_ME(Phalcon_Acl_AdapterInterface, isRole, arginfo_phalcon_acl_adapterinterface_isrole) - PHP_ABSTRACT_ME(Phalcon_Acl_AdapterInterface, setDefaultAction, arginfo_phalcon_acl_adapterinterface_setdefaultaction) - PHP_ABSTRACT_ME(Phalcon_Acl_AdapterInterface, setNoArgumentsDefaultAction, arginfo_phalcon_acl_adapterinterface_setnoargumentsdefaultaction) - PHP_FE_END -}; diff --git a/phalcon/Acl/Adapter.zep b/phalcon/Acl/Adapter/AbstractAdapter.zep similarity index 94% rename from phalcon/Acl/Adapter.zep rename to phalcon/Acl/Adapter/AbstractAdapter.zep index d9ba7b71b27..4909b5910d4 100644 --- a/phalcon/Acl/Adapter.zep +++ b/phalcon/Acl/Adapter/AbstractAdapter.zep @@ -8,7 +8,7 @@ * file that was distributed with this source code. */ -namespace Phalcon\Acl; +namespace Phalcon\Acl\Adapter; use Phalcon\Events\ManagerInterface; use Phalcon\Events\EventsAwareInterface; @@ -16,7 +16,7 @@ use Phalcon\Events\EventsAwareInterface; /** * Adapter for Phalcon\Acl adapters */ -abstract class Adapter implements AdapterInterface, EventsAwareInterface +abstract class AbstractAdapter implements AdapterInterface, EventsAwareInterface { /** * Active access which the list is checking if some role can access it diff --git a/phalcon/Acl/AdapterInterface.zep b/phalcon/Acl/Adapter/AdapterInterface.zep similarity index 94% rename from phalcon/Acl/AdapterInterface.zep rename to phalcon/Acl/Adapter/AdapterInterface.zep index 8f06a17b74c..94266d6fc2b 100644 --- a/phalcon/Acl/AdapterInterface.zep +++ b/phalcon/Acl/Adapter/AdapterInterface.zep @@ -8,7 +8,7 @@ * file that was distributed with this source code. */ -namespace Phalcon\Acl; +namespace Phalcon\Acl\Adapter; /** * Interface for Phalcon\Acl adapters @@ -108,12 +108,12 @@ interface AdapterInterface public function isRole(string roleName) -> bool; /** - * Sets the default access level (Phalcon\Acl::ALLOW or Phalcon\Acl::DENY) + * Sets the default access level (Phalcon\Ac\Enuml::ALLOW or Phalcon\Acl\Enum::DENY) */ public function setDefaultAction(int defaultAccess) -> void; /** - * Sets the default access level (Phalcon\Acl::ALLOW or Phalcon\Acl::DENY) + * Sets the default access level (Phalcon\Acl\Enum::ALLOW or Phalcon\Acl\Enum::DENY) * for no arguments provided in isAllowed action if there exists func for * accessKey */ diff --git a/phalcon/Acl/Adapter/Memory.zep b/phalcon/Acl/Adapter/Memory.zep index 0ef45b9c974..0b4d0af299e 100644 --- a/phalcon/Acl/Adapter/Memory.zep +++ b/phalcon/Acl/Adapter/Memory.zep @@ -10,8 +10,8 @@ namespace Phalcon\Acl\Adapter; -use Phalcon\Acl; -use Phalcon\Acl\Adapter; +use Phalcon\Acl\Adapter\AbstractAdapter; +use Phalcon\Acl\Enum; use Phalcon\Acl\Role; use Phalcon\Acl\RoleInterface; use Phalcon\Acl\Component; @@ -30,7 +30,7 @@ use ReflectionFunction; * $acl = new \Phalcon\Acl\Adapter\Memory(); * * $acl->setDefaultAction( - * \Phalcon\Acl::DENY + * \Phalcon\Acl\Enum::DENY * ); * * // Register roles @@ -149,7 +149,7 @@ class Memory extends Adapter * * @var mixed */ - protected noArgumentsDefaultAction = Acl::DENY; + protected noArgumentsDefaultAction = Enum::DENY; /** * Roles @@ -454,7 +454,7 @@ class Memory extends Adapter roleName, componentName, access, - Acl::ALLOW, + Enum::ALLOW, func ); } else { @@ -463,7 +463,7 @@ class Memory extends Adapter innerRoleName, componentName, access, - Acl::ALLOW, + Enum::ALLOW, func ); } @@ -492,14 +492,14 @@ class Memory extends Adapter var innerRoleName; if "*" !== roleName { - this->allowOrDeny(roleName, componentName, access, Acl::DENY, func); + this->allowOrDeny(roleName, componentName, access, Enum::DENY, func); } else { for innerRoleName, _ in this->rolesNames { this->allowOrDeny( innerRoleName, componentName, access, - Acl::DENY, + Enum::DENY, func ); } @@ -631,7 +631,7 @@ class Memory extends Adapter let rolesNames = this->rolesNames; if !isset rolesNames[roleName] { - return (this->defaultAccess == Acl::ALLOW); + return (this->defaultAccess == Enum::ALLOW); } /** @@ -664,7 +664,7 @@ class Memory extends Adapter */ let this->activeKey = roleName . "!" . componentName . "!" . access; - return this->defaultAccess == Acl::ALLOW; + return this->defaultAccess == Enum::ALLOW; } /** @@ -680,7 +680,7 @@ class Memory extends Adapter * array */ if parameterNumber === 0 { - return haveAccess == Acl::ALLOW && call_user_func(funcAccess); + return haveAccess == Enum::ALLOW && call_user_func(funcAccess); } let parametersForFunction = [], @@ -766,19 +766,19 @@ class Memory extends Adapter "'. We will use default action when no arguments." ); - return haveAccess == Acl::ALLOW && this->noArgumentsDefaultAction == Acl::ALLOW; + return haveAccess == Enum::ALLOW && this->noArgumentsDefaultAction == Enum::ALLOW; } /** * Number of required parameters == 0 so call funcAccess without * any arguments */ - return haveAccess == Acl::ALLOW && call_user_func(funcAccess); + return haveAccess == Enum::ALLOW && call_user_func(funcAccess); } // Check necessary parameters if count(parametersForFunction) >= numberOfRequiredParameters { - return haveAccess == Acl::ALLOW && call_user_func_array(funcAccess, parametersForFunction); + return haveAccess == Enum::ALLOW && call_user_func_array(funcAccess, parametersForFunction); } // We don't have enough parameters @@ -789,7 +789,7 @@ class Memory extends Adapter ); } - return haveAccess == Acl::ALLOW; + return haveAccess == Enum::ALLOW; } /** @@ -809,7 +809,7 @@ class Memory extends Adapter } /** - * Sets the default access level (`Phalcon\Acl::ALLOW` or `Phalcon\Acl::DENY`) + * Sets the default access level (`Phalcon\Enum::ALLOW` or `Phalcon\Enum::DENY`) * for no arguments provided in isAllowed action if there exists func for * accessKey */ diff --git a/phalcon/Acl/Enum.zep b/phalcon/Acl/Enum.zep new file mode 100644 index 00000000000..c41cb29c41c --- /dev/null +++ b/phalcon/Acl/Enum.zep @@ -0,0 +1,20 @@ + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ + +namespace Phalcon\Acl; + +/** + * Constants for Phalcon\Acl\Adapter adapters + */ +class Enum +{ + const ALLOW = 1; + const DENY = 0; +}