mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-06-02 20:59:28 +00:00
477ebe7cc7
- Added function getAuthPersonId to hlp_authentication helper - Added function isLogged to hlp_common helper - hlp_authentication helper functions getAuthPersonId and getAuthUID make use of isLogged function - AuthLib loads hlp_authentication helper after a successful login or if a user is already logged - FilterLib does NOT load anymore hlp_authentication helper - FilterLib does NOT use anymore BenutzerModel and getAuthUID, but retrieves user data directly using the person_id from getAuthPersonId
37 lines
1.3 KiB
PHP
37 lines
1.3 KiB
PHP
<?php
|
|
|
|
if (!defined('BASEPATH')) exit('No direct script access allowed');
|
|
|
|
// -----------------------------------------------------------------------------------------------------
|
|
// Functions needed to manage the user authentication
|
|
// NOTE: the following functions do NOT prompt a login page if the user is NOT logged in
|
|
// -----------------------------------------------------------------------------------------------------
|
|
|
|
/**
|
|
* If the user is NOT logged then a null value is returned.
|
|
* If the user is alredy logged, then it is possible to access to the authentication object
|
|
* that contains the person_id of the logged user
|
|
* NOTE: if a user is logged then a person_id is always present!
|
|
*/
|
|
function getAuthPersonId()
|
|
{
|
|
$ci =& get_instance(); // get CI instance
|
|
|
|
return isLogged() ? ($ci->authlib->getAuthObj())->{AuthLib::AO_PERSON_ID} : null;
|
|
}
|
|
|
|
|
|
/**
|
|
* If the user is NOT logged then a null value is returned.
|
|
* If the user is alredy logged, then it is possible to access to the authentication object
|
|
* that contains the username of the logged user
|
|
* NOTE: if the user is logged with a "foreign" method (ex. Bewerbungstool),
|
|
* then it is possible that the username is null!
|
|
*/
|
|
function getAuthUID()
|
|
{
|
|
$ci =& get_instance(); // get CI instance
|
|
|
|
return isLogged() ? ($ci->authlib->getAuthObj())->{AuthLib::AO_USERNAME} : null;
|
|
}
|