Merge branch 'feature-30659/SearchBar_Controller_sollte_Berechtigungen_berücksichtigen_können' into feature-25562/PV21_Datenbankstruktur_fuer_Vertraege_und_Gehaelter

This commit is contained in:
Harald Bamberger
2024-01-10 14:19:37 +01:00
2 changed files with 9 additions and 2 deletions
@@ -17,11 +17,17 @@ class SearchBar extends FHC_Controller
{
parent::__construct();
// Loads the AuthLib and starts the authentication
$this->load->library('AuthLib');
// Loads the AuthLib _without_ starting the authentication
// NOTE:
// - A user must be authenticated via another controller to access this one
// - It is loaded to be able to call the isLogged function later
$this->load->library('AuthLib', array(false));
// Load the library SearchBarLib
$this->load->library('SearchBarLib');
// Checks if the user is authenticated, otherwise returns an error code in JSON format
if (!isLogged()) $this->terminateWithJsonError(SearchBarLib::ERROR_NOT_AUTH);
}
//------------------------------------------------------------------------------------------------------------------
+1
View File
@@ -30,6 +30,7 @@ class SearchBarLib
const ERROR_WRONG_SEARCHSTR = 'ERR002';
const ERROR_NO_TYPES = 'ERR003';
const ERROR_WRONG_TYPES = 'ERR004';
const ERROR_NOT_AUTH = 'ERR005';
// List of allowed types of search
const ALLOWED_TYPES = ['mitarbeiter', 'mitarbeiter_ohne_zuordnung', 'organisationunit', 'raum', 'person', 'student', 'prestudent', 'document', 'cms'];