- codeigniter-restserver is now provided and loaded via composer (libraries/REST_Controller.php, config/rest.php, language/english/rest_controller_lang.php, libraries/Format.php, etc)

- Added new core controller core/RESTFul_Controller.php that extends REST_Controller and partially overrides part of the latter
- Changed application/config/rest.php to keep the minimal useful set of configs
- Controllers core/APIv1_Controller, controllers/api/v1/CheckUserAuth.php and controllers/api/v1/Test.php now extend core/RESTFul_Controller
- Changed method _remap interface for core/APIv1_Controller
- Removed application/core/REST_Controller.php
- Removed application/libraries/Format.php
- Removed application/language/english/rest_controller_lang.php
This commit is contained in:
Paolo
2019-07-31 14:46:31 +02:00
parent d0605ba3cf
commit d2e8b01e30
11 changed files with 305 additions and 3114 deletions
+7 -4
View File
@@ -1,9 +1,11 @@
<?php
if (! defined('BASEPATH')) exit('No direct script access allowed');
/**
* REST_Controller takes care about authentication and it loads the AuthLib
*
*/
class APIv1_Controller extends REST_Controller
class APIv1_Controller extends RESTFul_Controller
{
private $_requiredPermissions;
@@ -21,13 +23,14 @@ class APIv1_Controller extends REST_Controller
/**
* This method is automatically called by CodeIgniter after the execution of the constructor is completed
* - Cheks if the AuthLib was loaded, if not it means that the authentication failed
* - Cheks if the Authlib was loaded, if not it means that the authentication failed
* - Loads the permsission lib and calls permissionlib->isEntitled
* - Checks if the caller is allowed to access to this content with the given permissions
* if it is not allowed will set the HTTP header with code 401
* - Calls the parent (REST_Controller) _remap method to performs other checks
* NOTE: this methods override the parent method!!!
*/
public function _remap($object_called, $arguments)
public function _remap($object_called, $arguments = [])
{
if (isset($this->authlib)) // if set then the authentication is ok
{