- Moved REST_Controller from libraries to core directory

- Changed the relatives includes
- Changed the controller api/v1/CheckUserAuth to be adapted to the AuthLib changes
- Removed function auth from helpers/hlp_authentication_helper
- Adapted function getAuthUID of helpers/hlp_authentication_helper to the AuthLib changes
- Adapted constructor of PermissionLib to the AuthLib changes
This commit is contained in:
Paolo
2019-02-27 11:24:27 +01:00
parent c20d7779ca
commit fdddb52259
6 changed files with 66 additions and 109 deletions
@@ -1,21 +1,7 @@
<?php
/**
* FH-Complete
*
* @package FHC-API
* @author FHC-Team
* @copyright Copyright (c) 2016, fhcomplete.org
* @license GPLv3
* @link http://fhcomplete.org
* @since Version 1.0
* @filesource
*/
// ------------------------------------------------------------------------
if (!defined('BASEPATH')) exit('No direct script access allowed');
require_once APPPATH.'/libraries/REST_Controller.php';
class CheckUserAuth extends REST_Controller
{
/**
@@ -24,6 +10,10 @@ class CheckUserAuth extends REST_Controller
public function __construct()
{
parent::__construct();
// Loads helper message to manage returning messages
// NOTE: loaded here because it does not extend the APIv1_Controller
$this->load->helper('hlp_message');
}
/**
@@ -36,7 +26,7 @@ class CheckUserAuth extends REST_Controller
if (isset($username) && isset($password))
{
$result = $this->authlib->CheckUserAuthByUsernamePassword($username, $password);
$result = $this->authlib->checkUserAuthByUsernamePassword($username, $password);
$this->response($result, REST_Controller::HTTP_OK);
}
@@ -63,18 +53,18 @@ class CheckUserAuth extends REST_Controller
// If username and password are given then check authentication using them
if (isset($username) && isset($password))
{
$result = $this->authlib->CheckUserAuthByUsernamePassword($username, $password, true);
$result = $this->authlib->checkUserAuthByUsernamePassword($username, $password, true);
}
elseif (isset($code) || isset($email))
{
// If code and email are given then check authentication using them
if (isset($code) && isset($email))
{
$result = $this->authlib->CheckUserAuthByCodeEmail($code, $email);
$result = $this->authlib->checkUserAuthByCodeEmail($code, $email);
}
else // otherwise check authentication using only code
{
$result = $this->authlib->CheckUserAuthByCode($code);
$result = $this->authlib->checkUserAuthByCode($code);
}
}