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
+2 -2
View File
@@ -15,9 +15,9 @@ class Documents extends Auth_Controller
public function __construct()
{
parent::__construct([
'index' => ['student/anrechnung_beantragen:r','user:r'], // TODO(chris): permissions?
'index' => [self::PERM_LOGGED],
'student' => ['admin:r'],
'download' => ['student/anrechnung_beantragen:r','user:r'] // TODO(chris): permissions?
'download' => [self::PERM_LOGGED]
]);
$this->load->model('crm/Prestudentstatus_model', 'PrestudentstatusModel');
+2 -2
View File
@@ -13,8 +13,8 @@ class MyLv extends Auth_Controller
public function __construct()
{
parent::__construct([
'index' => ['student/anrechnung_beantragen:r','user:r'], // TODO(chris): permissions?
'Info' => ['student/anrechnung_beantragen:r','user:r'] // TODO(chris): permissions?
'index' => ['basis/cis:r'],
'Info' => [self::PERM_LOGGED]
]);
}
+10 -10
View File
@@ -13,16 +13,16 @@ class Profil extends Auth_Controller
public function __construct()
{
parent::__construct([
'index' => ['student/anrechnung_beantragen:r', 'user:r'],
'foto_sperre_function' => ['student/anrechnung_beantragen:r', 'user:r'],
'getView' => ['student/anrechnung_beantragen:r', 'user:r'],
'View' => ['student/anrechnung_beantragen:r', 'user:r'],
'isMitarbeiter' => ['student/anrechnung_beantragen:r', 'user:r'],
'isStudent' => ['student/anrechnung_beantragen:r', 'user:r'],
'getZustellAdresse' => ['student/anrechnung_beantragen:r', 'user:r'],
'getZustellKontakt' => ['student/anrechnung_beantragen:r', 'user:r'],
'getAllNationen' => ['student/anrechnung_beantragen:r', 'user:r'],
'getGemeinden' => ['student/anrechnung_beantragen:r', 'user:r'],
'index' => ['basis/cis:r'],
'foto_sperre_function' => ['basis/cis:r'],
'getView' => ['basis/cis:r'],
'View' => ['basis/cis:r'],
'isMitarbeiter' => ['basis/cis:r'],
'isStudent' => ['basis/cis:r'],
'getZustellAdresse' => ['basis/cis:r'],
'getZustellKontakt' => ['basis/cis:r'],
'getAllNationen' => ['basis/cis:r'],
'getGemeinden' => ['basis/cis:r'],
]);
+9 -9
View File
@@ -24,16 +24,16 @@ class ProfilUpdate extends Auth_Controller
'getProfilUpdateWithPermission' => ['student/stammdaten:r', 'mitarbeiter/stammdaten:r'],
'acceptProfilRequest' => ['student/stammdaten:rw', 'mitarbeiter/stammdaten:rw'],
'denyProfilRequest' => ['student/stammdaten:rw', 'mitarbeiter/stammdaten:rw'],
'show' => ['student/anrechnung_beantragen:r', 'user:r'],
'show' => ['basis/cis:r'],
'insertProfilRequest' => ['student/anrechnung_beantragen:r', 'user:r'],
'updateProfilRequest' => ['student/anrechnung_beantragen:r', 'user:r'],
'deleteProfilRequest' => ['student/anrechnung_beantragen:r', 'user:r'],
'selectProfilRequest' => ['student/anrechnung_beantragen:r', 'user:r'],
'insertFile' => ['student/anrechnung_beantragen:r', 'user:r'],
'getProfilRequestFiles' => ['student/anrechnung_beantragen:r', 'user:r'],
'getStatus' => ['student/anrechnung_beantragen:r', 'user:r'],
'getTopic' => ['student/anrechnung_beantragen:r', 'user:r'],
'insertProfilRequest' => ['basis/cis:rw'],
'updateProfilRequest' => ['basis/cis:rw'],
'deleteProfilRequest' => ['basis/cis:rw'],
'selectProfilRequest' => ['basis/cis:r'],
'insertFile' => ['basis/cis:rw'],
'getProfilRequestFiles' => ['basis/cis:r'],
'getStatus' => ['basis/cis:r'],
'getTopic' => ['basis/cis:r'],
]);
+6 -6
View File
@@ -5,18 +5,18 @@ if (! defined('BASEPATH')) exit('No direct script access allowed');
/**
*
*/
class Pub extends FHC_Controller
class Pub extends Auth_Controller
{
/**
* Constructor
*/
public function __construct()
{
parent::__construct();
// Load Libraries
$this->load->library('AuthLib');
$this->load->library('PermissionLib');
parent::__construct(
array(
'bild' => ['basis/cis:r']
)
);
}
// -----------------------------------------------------------------------------------------------------------------
+1 -1
View File
@@ -13,7 +13,7 @@ class Stundenplan extends Auth_Controller
public function __construct()
{
parent::__construct([
'index' => ['student/anrechnung_beantragen:r','user:r'] // TODO(chris): permissions?
'index' => ['basis/cis:r']
]);
}
+6 -6
View File
@@ -5,18 +5,18 @@ if (! defined('BASEPATH')) exit('No direct script access allowed');
/**
*
*/
class Cis4 extends FHC_Controller
class Cis4 extends Auth_Controller
{
/**
* Constructor
*/
public function __construct()
{
parent::__construct();
// Loads Libraries
$this->load->library('AuthLib');
$this->load->library('PermissionLib');
parent::__construct(
array(
'index' => 'basis/cis:r'
)
);
}
// -----------------------------------------------------------------------------------------------------------------
+7 -5
View File
@@ -7,16 +7,18 @@ use \DOMDocument as DOMDocument;
/**
*
*/
class CisHmvc extends FHC_Controller
class CisHmvc extends Auth_Controller
{
/**
* Constructor
*/
public function __construct()
{
parent::__construct();
$this->load->library('AuthLib');
$this->load->library('PermissionLib');
parent::__construct(
array(
'index' => 'basis/cis:r'
)
);
$this->load->model('content/Content_model', 'ContentModel');
}
@@ -43,7 +45,7 @@ class CisHmvc extends FHC_Controller
$path = explode('/', uri_string());
array_shift($path); // NOTE(chris): remove cis4/
$menu = $this->ContentModel->getMenu(6739, get_uid());
$menu = $this->ContentModel->getMenu(6739, getAuthUID());
if (isError($menu)) {
// TODO(chris): Error Handling
return $this->load->view('CisHmvc/Error', ['error' => getError($menu)]);
@@ -14,7 +14,7 @@ class Dashboard extends Auth_Controller
{
parent::__construct(
array(
'index' => 'user:r'
'index' => 'dashboard/benutzer:r'
)
);
}
+7 -4
View File
@@ -6,7 +6,7 @@ if (!defined('BASEPATH'))
/**
*
*/
class Cms extends FHC_Controller
class Cms extends Auth_Controller
{
/**
* Constructor
@@ -14,11 +14,14 @@ class Cms extends FHC_Controller
public function __construct()
{
parent::__construct();
parent::__construct(
array(
'content' => 'basis/cis:r',
'news' => 'basis/cis:r',
)
);
// Loads Libraries
$this->load->library('AuthLib');
$this->load->library('PermissionLib');
$this->load->library('CmsLib');
// Loads phrases system
@@ -14,7 +14,7 @@ class Dashboard extends Auth_Controller
{
parent::__construct(
array(
'index' => 'user:r'
'index' => 'dashboard/benutzer:r'
)
);
+10 -4
View File
@@ -6,18 +6,24 @@ if (!defined('BASEPATH'))
/**
*
*/
class Cms extends FHC_Controller
class Cms extends Auth_Controller
{
/**
* Constructor
*/
public function __construct()
{
parent::__construct();
parent::__construct(
array(
'content' => 'basis/cis:r',
'getNews' => 'basis/cis:r',
'getNewsRowCount' => 'basis/cis:r',
'getRoomInformation' => 'basis/cis:r',
'news' => 'basis/cis:r'
)
);
// Loads Libraries
$this->load->library('AuthLib');
$this->load->library('PermissionLib');
$this->load->library('CmsLib');
// Loads phrases system
+1 -1
View File
@@ -14,7 +14,7 @@ class Dashboard extends Auth_Controller
{
parent::__construct(
array(
'index' => 'user:r'
'index' => 'dashboard/benutzer:r'
)
);
}
@@ -179,6 +179,8 @@ class Cms extends FHCAPI_Controller
$news = $this->getDataOrTerminateWithError($news);
$this->addMeta('test', $this->p->t('global', 'studiengangsleitung'));
$this->addMeta('phrases', json_decode($this->p->getJson()));
$this->terminateWithSuccess($news);
}
@@ -84,7 +84,7 @@ class LvMenu extends FHCAPI_Controller
die($p->t('global/fehlerBeimOeffnenDerDatenbankverbindung'));
// get the user
if (!$user=get_uid())
if (!$user=getAuthUID())
die($p->t('global/nichtAngemeldet'));
// check if is_lector
@@ -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);
@@ -16,7 +16,7 @@ class DashboardDemo extends Auth_Controller
// Set required permissions
parent::__construct(
array(
'index' => 'user:r',
'index' => 'dashboard/benutzer:r',
'admin' => 'dashboard/admin:rw'
)
);
@@ -18,7 +18,7 @@ $this->load->view('templates/FHC-Header', $includesArray);
if (!isset($menu)) {
$ci =& get_instance(); // get CI instance
$ci->load->model('content/Content_model', 'ContentModel');
$result = $ci->ContentModel->getMenu(null, get_uid());
$result = $ci->ContentModel->getMenu(null, getAuthUID());
$menu = getData($result) ?? (object)['childs' => []];
}
?>
@@ -20,7 +20,7 @@ if (!isset($menu)) {
$ci =& get_instance(); // get CI instance
$ci->load->model('content/Content_model', 'ContentModel');
$cis4_content_id = $ci->ContentModel->getCIS4_ContentID();
$result = $ci->ContentModel->getMenu($cis4_content_id, get_uid());
$result = $ci->ContentModel->getMenu($cis4_content_id, getAuthUID());
$menu = getData($result)->childs ?? [];
}
?>