From 09954c479ca08f9d92e8d01781d5c46558050929 Mon Sep 17 00:00:00 2001 From: Cris Date: Wed, 23 Feb 2022 09:45:45 +0100 Subject: [PATCH] Changed: Now checking by permission and not by benutzerfunktion Before, permission for page access and download was checked by benutzerfunktion. This did not allow access by user with corresponding permissions, like admins. Therfore changed to check by permission only. --- .../anrechnung/ApproveAnrechnungDetail.php | 64 +++---------------- .../ApproveAnrechnungUebersicht.php | 32 ++-------- 2 files changed, 12 insertions(+), 84 deletions(-) diff --git a/application/controllers/lehre/anrechnung/ApproveAnrechnungDetail.php b/application/controllers/lehre/anrechnung/ApproveAnrechnungDetail.php index 5a3c4ba27..28edf4824 100644 --- a/application/controllers/lehre/anrechnung/ApproveAnrechnungDetail.php +++ b/application/controllers/lehre/anrechnung/ApproveAnrechnungDetail.php @@ -81,7 +81,7 @@ class approveAnrechnungDetail extends Auth_Controller } // Check if user is entitled to read the Anrechnung - self::_checkIfEntitledToReadAnrechnung($anrechnung_id); + $this->_checkIfEntitledToReadAnrechnung($anrechnung_id); // Get Anrechung data $anrechnungData = $this->anrechnunglib->getAnrechnungData($anrechnung_id); @@ -390,7 +390,7 @@ class approveAnrechnungDetail extends Auth_Controller } // Check if user is entitled to read dms doc - self::_checkIfEntitledToReadDMSDoc($dms_id); + $this->_checkIfEntitledToReadDMSDoc($dms_id); // Set filename to be used on downlaod $filename = $this->anrechnunglib->setFilenameOnDownload($dms_id); @@ -428,35 +428,11 @@ class approveAnrechnungDetail extends Auth_Controller $studiengang_kz = getData($result)[0]->studiengang_kz; - // Check if user is STGL - $result = $this->StudiengangModel->getLeitung($studiengang_kz); - - if (hasData($result)) - { - foreach (getData($result) as $stgl) - { - if ($stgl->uid == $this->_uid) - { - return; - } - } - } - - // Check if user is Assistance - $result = $this->StudiengangModel->getAssistance($studiengang_kz); - - if (hasData($result)) + // Check if user is entitled + if (!$this->permissionlib->isBerechtigt(self::BERECHTIGUNG_ANRECHNUNG_GENEHMIGEN, 's', $studiengang_kz)) { - foreach (getData($result) as $assistance) - { - if ($assistance->uid == $this->_uid) - { - return; - } - } + show_error('You are not entitled to read this page'); } - - show_error('You are not entitled to read this Anrechnung'); } /** @@ -478,35 +454,11 @@ class approveAnrechnungDetail extends Auth_Controller $studiengang_kz = getData($result)[0]->studiengang_kz; - // Get STGL - $result = $this->StudiengangModel->getLeitung($studiengang_kz); - - if (hasData($result)) + // Check if user is entitled + if (!$this->permissionlib->isBerechtigt(self::BERECHTIGUNG_ANRECHNUNG_GENEHMIGEN, 's', $studiengang_kz)) { - foreach (getData($result) as $stgl) - { - if ($stgl->uid == $this->_uid) - { - return; - } - } + show_error('You are not entitled to read this document'); } - - // Check if user is Assistance - $result = $this->StudiengangModel->getAssistance($studiengang_kz); - - if (hasData($result)) - { - foreach (getData($result) as $assistance) - { - if ($assistance->uid == $this->_uid) - { - return; - } - } - } - - show_error('You are not entitled to read this document'); } /** diff --git a/application/controllers/lehre/anrechnung/ApproveAnrechnungUebersicht.php b/application/controllers/lehre/anrechnung/ApproveAnrechnungUebersicht.php index 2030f9923..053988848 100644 --- a/application/controllers/lehre/anrechnung/ApproveAnrechnungUebersicht.php +++ b/application/controllers/lehre/anrechnung/ApproveAnrechnungUebersicht.php @@ -249,7 +249,7 @@ class approveAnrechnungUebersicht extends Auth_Controller } // Check if user is entitled to read dms doc - self::_checkIfEntitledToReadDMSDoc($dms_id); + $this->_checkIfEntitledToReadDMSDoc($dms_id); // Set filename to be used on downlaod $filename = $this->anrechnunglib->setFilenameOnDownload($dms_id); @@ -294,35 +294,11 @@ class approveAnrechnungUebersicht extends Auth_Controller $studiengang_kz = $result->studiengang_kz; - // Check if user is STGL - $result = $this->StudiengangModel->getLeitung($studiengang_kz); - - if (hasData($result)) - { - foreach (getData($result) as $stgl) - { - if ($stgl->uid == $this->_uid) - { - return; - } - } - } - - // Check if user is Assistance - $result = $this->StudiengangModel->getAssistance($studiengang_kz); - - if (hasData($result)) + // Check if user is entitled + if (!$this->permissionlib->isBerechtigt(self::BERECHTIGUNG_ANRECHNUNG_GENEHMIGEN, 's', $studiengang_kz)) { - foreach (getData($result) as $assistance) - { - if ($assistance->uid == $this->_uid) - { - return; - } - } + show_error('You are not entitled to read this document'); } - - show_error('You are not entitled to read this document'); } /**