use getAuthUID function instead of get_uid, use new permission basis/cis and switch to Auth_Controller where possible

This commit is contained in:
Harald Bamberger
2024-11-04 15:41:02 +01:00
parent a65e94bc8a
commit 50880c696b
21 changed files with 84 additions and 76 deletions
@@ -31,7 +31,7 @@ class Mylv extends Auth_Controller
{
$this->load->model('education/Lehrveranstaltung_model', 'LehrveranstaltungModel');
$result = $this->LehrveranstaltungModel->getLvsByStudentWithGrades(get_uid());
$result = $this->LehrveranstaltungModel->getLvsByStudentWithGrades(getAuthUID());
if (isError($result))
return $this->outputJsonError(getError($result));
@@ -45,7 +45,7 @@ class Mylv extends Auth_Controller
{
$this->load->model('organisation/Studiensemester_model', 'StudiensemesterModel');
$result = $this->StudiensemesterModel->getWhereStudentHasLvs(get_uid());
$result = $this->StudiensemesterModel->getWhereStudentHasLvs(getAuthUID());
if (isError($result))
return $this->outputJsonError(getError($result));
@@ -59,7 +59,7 @@ class Mylv extends Auth_Controller
{
$this->load->model('education/Lehrveranstaltung_model', 'LehrveranstaltungModel');
$result = $this->LehrveranstaltungModel->getLvsByStudentWithGrades(get_uid(), $studiensemester_kurzbz, getUserLanguage());
$result = $this->LehrveranstaltungModel->getLvsByStudentWithGrades(getAuthUID(), $studiensemester_kurzbz, getUserLanguage());
if (isError($result))
return $this->outputJsonError(getError($result));
@@ -202,7 +202,7 @@ class Mylv extends Auth_Controller
{
$this->load->model('education/Pruefung_model', 'PruefungModel');
$result = $this->PruefungModel->getByStudentAndLv(get_uid(), $lehrveranstaltung_id, getUserLanguage());
$result = $this->PruefungModel->getByStudentAndLv(getAuthUID(), $lehrveranstaltung_id, getUserLanguage());
if (isError($result))
return $this->outputJsonError(getError($result));
@@ -14,9 +14,9 @@ class Stundenplan extends Auth_Controller
public function __construct()
{
parent::__construct([
'index' => ['student/anrechnung_beantragen:r','user:r'], // TODO(chris): permissions?
'Reservierungen' => ['student/anrechnung_beantragen:r','user:r'], // TODO(chris): permissions?
'Stunden' => ['student/anrechnung_beantragen:r','user:r'], // TODO(chris): permissions?
'index' => ['basis/cis'],
'Reservierungen' => ['basis/cis'],
'Stunden' => ['basis/cis'],
]);
}
@@ -29,12 +29,12 @@ class Stundenplan extends Auth_Controller
{
$this->load->model('ressource/Stundenplan_model', 'StundenplanModel');
/* $result = $this->StundenplanModel->loadForUid(get_uid());
/* $result = $this->StundenplanModel->loadForUid(getAuthUID());
if (isError($result))
return $this->outputJsonError(getError($result));
*/
$res = $this->StundenplanModel->stundenplanGruppierung($this->StundenplanModel->getStundenplanQuery(get_uid()));
$res = $this->StundenplanModel->stundenplanGruppierung($this->StundenplanModel->getStundenplanQuery(getAuthUID()));
$res = getData($res);
@@ -47,7 +47,7 @@ class Stundenplan extends Auth_Controller
{
$this->load->model('ressource/Reservierung_model', 'ReservierungModel');
$result = $this->ReservierungModel->loadForUid(get_uid());
$result = $this->ReservierungModel->loadForUid(getAuthUID());
if (isError($result))
return $this->outputJsonError(getError($result));
+5 -10
View File
@@ -5,7 +5,7 @@ if (! defined('BASEPATH')) exit('No direct script access allowed');
/**
*
*/
class CisVue extends FHC_Controller
class CisVue extends Auth_Controller
{
/**
@@ -13,14 +13,9 @@ class CisVue extends FHC_Controller
*/
public function __construct()
{
parent::__construct();
// Loads authentication library and starts authentication
$this->load->library('AuthLib');
$this->load->library('PermissionLib');
if (!isLogged())
show_404();
parent::__construct([
'Menu' => [self::PERM_LOGGED]
]);
}
//------------------------------------------------------------------------------------------------------------------
@@ -31,7 +26,7 @@ class CisVue extends FHC_Controller
public function Menu()
{
$this->load->model('content/Content_model', 'ContentModel');
$result = $this->ContentModel->getMenu(defined('CIS4_MENU_ENTRY') ? CIS4_MENU_ENTRY : null, get_uid());
$result = $this->ContentModel->getMenu(defined('CIS4_MENU_ENTRY') ? CIS4_MENU_ENTRY : null, getAuthUID());
$menu = getData($result) ?? (object)['childs' => []];
$this->outputJsonSuccess($menu);