Assistenten koennen nur Profil Aenderungen von Studenten ansehen deren Organisationseinheit in den Berechtigung des Assistenten vorhanden sind (und kleiner sessionStorage fix der einen String zu Boolean converted)

This commit is contained in:
SimonGschnell
2024-02-08 11:48:14 +01:00
parent fa1871a059
commit 89bc5a5d9d
2 changed files with 41 additions and 16 deletions
@@ -58,11 +58,30 @@ class Profil_update_model extends DB_Model
$studentBerechtigung = $this->permissionlib->isBerechtigt('student/stammdaten','s');
$mitarbeiterBerechtigung = $this->permissionlib->isBerechtigt('mitarbeiter/stammdaten','s');
$oe_berechtigung = $this->permissionlib->getOE_isEntitledFor('student/stammdaten');
$res =[];
if($studentBerechtigung) {
$this->addJoin('tbl_student','tbl_student.student_uid=tbl_profil_update.uid');
$studentRequests = $this->loadWhere($whereClause);
//? Nur wenn der/die AssistentIn auch die Berechtigung in der gleichen Organisationseinheit des Studenten hat
$parameters = [];
$query="
SELECT * FROM public.tbl_profil_update
JOIN public.tbl_student ON public.tbl_student.student_uid=public.tbl_profil_update.uid
JOIN public.tbl_prestudent ON public.tbl_prestudent.prestudent_id=public.tbl_student.prestudent_id
JOIN public.tbl_studiengang ON public.tbl_studiengang.studiengang_kz=public.tbl_prestudent.studiengang_kz
JOIN public.tbl_organisationseinheit ON public.tbl_organisationseinheit.oe_kurzbz=public.tbl_studiengang.oe_kurzbz
Where public.tbl_studiengang.oe_kurzbz IN ? ";
$parameters[]=$oe_berechtigung;
if($whereClause){
foreach($whereClause as $key=>$value){
$parameters[] = $value;
$query .= " AND ".$key." = ?";
}
}
$studentRequests =$this->execReadOnlyQuery($query,$parameters);
if(isError($studentRequests)) return error("db error: ". getData($studentRequests));
$studentRequests = getData($studentRequests)?:[];
foreach($studentRequests as $request){
@@ -70,6 +89,7 @@ class Profil_update_model extends DB_Model
}
}
if($mitarbeiterBerechtigung) {
$this->addJoin('tbl_mitarbeiter','tbl_mitarbeiter.mitarbeiter_uid=tbl_profil_update.uid');
$mitarbeiterRequests = $this->loadWhere($whereClause);
if(isError($mitarbeiterRequests)) return error("db error: ". getData($mitarbeiterRequests));
+19 -14
View File
@@ -29,7 +29,22 @@ const app = Vue.createApp({
data() {
return {
showAll: false,
profil_updates_table_options: {
ajaxURL:
FHC_JS_DATA_STORAGE_OBJECT.app_root +
FHC_JS_DATA_STORAGE_OBJECT.ci_router +
`/Cis/ProfilUpdate/`,
ajaxURLGenerator: (url, config, params) => {
//? this function needs to be an array function in order to access the this properties of the Vue component
console.log("showAll printed here:", this.showAll);
if (this.showAll) {
return url + "getProfilUpdates";
} else {
return url + "getProfilUpdates/pending";
}
},
ajaxResponse: function (url, params, response) {
//url - the URL of the request
//params - the parameters passed with the request
@@ -118,19 +133,7 @@ const app = Vue.createApp({
}
return menu;
},
ajaxURL:
FHC_JS_DATA_STORAGE_OBJECT.app_root +
FHC_JS_DATA_STORAGE_OBJECT.ci_router +
`/Cis/ProfilUpdate/`,
ajaxURLGenerator: (url, config, params) => {
//? this function needs to be an array function in order to access the this properties of the Vue component
if (this.showAll) {
return url + "getProfilUpdates";
} else {
return url + "getProfilUpdates/pending";
}
},
height: 600,
layout: "fitColumns",
@@ -241,7 +244,9 @@ const app = Vue.createApp({
},
mounted() {
if (!(sessionStorage.getItem("showAll") === null)) {
this.showAll = JSON.parse(sessionStorage.getItem("showAll"));
//? converting string into a boolean: https://sentry.io/answers/how-can-i-convert-a-string-to-a-boolean-in-javascript/
this.showAll = sessionStorage.getItem("showAll")==="true";
}
},
template: `