little bugfix

This commit is contained in:
SimonGschnell
2024-02-12 14:08:26 +01:00
parent 6aa0bbb037
commit 78bffb1348
+5 -6
View File
@@ -15,7 +15,7 @@ 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'],
'show'=>['student/anrechnung_beantragen:r','user:r'],
'insertProfilRequest' => ['student/anrechnung_beantragen:r', 'user:r'],
'updateProfilRequest' => ['student/anrechnung_beantragen:r', 'user:r'],
@@ -51,21 +51,20 @@ class ProfilUpdate extends Auth_Controller
}
public function show($dms_id){
$profil_update = $this->ProfilUpdateModel->loadWhere(['attachment_id'=>$dms_id]);
$profil_update = hasData($profil_update) ? getData($profil_update)[0] : null;
//? checks if an profil update exists with the dms_id requested from the user
if($profil_update){
$is_mitarbeiter_profil_update = $this->MitarbeiterModel->isMitarbeiter($profil_update->uid);
$is_student_profil_update = $this->StudentModel->isStudent($profil_update->uid);
$is_mitarbeiter_profil_update = getData($this->MitarbeiterModel->isMitarbeiter($profil_update->uid));
$is_student_profil_update = getData($this->StudentModel->isStudent($profil_update->uid));
if(
$this->permissionlib->isBerechtigt('student/stammdaten:r') && $is_student_profil_update ||
$this->permissionlib->isBerechtigt('mitarbeiter/stammdaten:r') && $is_mitarbeiter_profil_update ||
$this->uid == $profil_update->uid)
{
// Get file to be downloaded from DMS
$newFilename= $this->uid."/document_".$dms_id;
$download = $this->dmslib->download($dms_id, $newFilename);