. */ if (!defined('BASEPATH')) exit('No direct script access allowed'); class AuthInfo extends FHCAPI_Controller { protected $uid; protected $pid; protected $isMitarbeiter; protected $isStudent; /** * Object initialization */ public function __construct() { parent::__construct([ 'getAuthUID' => self::PERM_LOGGED, 'getAuthInfo' => self::PERM_LOGGED, ]); $this->load->model('crm/Student_model', 'StudentModel'); $this->load->model('ressource/Mitarbeiter_model', 'MitarbeiterModel'); $this->uid = getAuthUID(); $this->pid = getAuthPersonID(); $this->isMitarbeiter = getData($this->MitarbeiterModel->isMitarbeiter($this->uid)) ?? false; $this->isStudent = getData($this->StudentModel->isStudent($this->uid)) ?? false; } //------------------------------------------------------------------------------------------------------------------ // Public methods /** * returns the uid of the currently logged in user * @access public * */ public function getAuthUID() { $this->terminateWithSuccess(['uid'=>$this->uid]); } public function getAuthInfo() { $data = (object) array( 'uid' => $this->uid, 'isMitarbeiter' => $this->isMitarbeiter, 'isStudent' => $this->isStudent ); $this->terminateWithSuccess($data); } }