mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-06-17 12:09:28 +00:00
check editZgv Permission for Stg and also check it in api function
This commit is contained in:
@@ -32,9 +32,9 @@ class Studentenverwaltung extends Auth_Controller
|
||||
'student/keine_studstatuspruefung' => $this->permissionlib->isBerechtigt('student/keine_studstatuspruefung'),
|
||||
'lehre/reihungstestAufsicht' => $this->permissionlib->isBerechtigt('lehre/reihungstestAufsicht'),
|
||||
'system/change_outputformat' => $this->permissionlib->getOE_isEntitledFor('system/change_outputformat'),
|
||||
'student/editBakkZgv' => $this->permissionlib->isBerechtigt('student/editBakkZgv'),
|
||||
'student/editMakkZgv' => $this->permissionlib->isBerechtigt('student/editMakkZgv'),
|
||||
'student/editDokZgv' => $this->permissionlib->isBerechtigt('student/editDokZgv'),
|
||||
'student/editBakkZgv' => $this->permissionlib->getSTG_isEntitledFor('student/editBakkZgv') ?: array(),
|
||||
'student/editMakkZgv' => $this->permissionlib->getSTG_isEntitledFor('student/editMakkZgv') ?: array(),
|
||||
'student/editDokZgv' => $this->permissionlib->getSTG_isEntitledFor('student/editDokZgv') ?: array(),
|
||||
'student/editBismelden' => $this->permissionlib->isBerechtigt('student/editBismelden')
|
||||
],
|
||||
'variables' => [
|
||||
|
||||
@@ -43,7 +43,7 @@ class Prestudent extends FHCAPI_Controller
|
||||
|
||||
// Load language phrases
|
||||
$this->loadPhrases([
|
||||
'ui', 'studierendenantrag', 'lehre'
|
||||
'ui', 'studierendenantrag', 'lehre', 'global'
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -98,11 +98,9 @@ class Prestudent extends FHCAPI_Controller
|
||||
'person_id',
|
||||
'berufstaetigkeit_code',
|
||||
'ausbildungcode',
|
||||
'zgv_code',
|
||||
'zgvort',
|
||||
'zgvdatum',
|
||||
'zgvnation',
|
||||
'zgvmas_code',
|
||||
'zgvmaort',
|
||||
'zgvmadatum',
|
||||
'zgvmanation',
|
||||
@@ -110,7 +108,6 @@ class Prestudent extends FHCAPI_Controller
|
||||
'bismelden',
|
||||
'anmerkung',
|
||||
'dual',
|
||||
'zgvdoktor_code',
|
||||
'zgvdoktorort',
|
||||
'zgvdoktordatum',
|
||||
'zgvdoktornation',
|
||||
@@ -125,6 +122,57 @@ class Prestudent extends FHCAPI_Controller
|
||||
'standort_code'
|
||||
];
|
||||
|
||||
// add zgv code fields only if user has permission
|
||||
$this->load->library('PermissionLib');
|
||||
$prestudentres = $this->PrestudentModel->load($prestudent_id);
|
||||
if(!hasData($prestudentres))
|
||||
{
|
||||
$this->terminateWithError($this->p->t('ui', 'error_fieldNotFound', ['field' => 'Prestudent ' . $prestudent_id]));
|
||||
}
|
||||
$prestudent = (getData($prestudentres))[0];
|
||||
$bakkZgvStg = $this->permissionlib->getSTG_isEntitledFor('student/editBakkZgv') ?: array();
|
||||
$makkZgvStg = $this->permissionlib->getSTG_isEntitledFor('student/editMakkZgv') ?: array();
|
||||
$dokZgvStg = $this->permissionlib->getSTG_isEntitledFor('student/editDokZgv') ?: array();
|
||||
|
||||
if(in_array($prestudent->studiengang_kz, $bakkZgvStg))
|
||||
{
|
||||
$array_allowed_props_prestudent[] = 'zgv_code';
|
||||
}
|
||||
else if(!is_null($this->input->post('zgv_code')))
|
||||
{
|
||||
$this->terminateWithError(
|
||||
$this->p->t('global', 'zgv')
|
||||
. ' - ' .
|
||||
$this->p->t('ui', 'error_keineBerechtigungStg')
|
||||
);
|
||||
}
|
||||
|
||||
if(in_array($prestudent->studiengang_kz, $makkZgvStg))
|
||||
{
|
||||
$array_allowed_props_prestudent[] = 'zgvmas_code';
|
||||
}
|
||||
else if(!is_null($this->input->post('zgvmas_code')))
|
||||
{
|
||||
$this->terminateWithError(
|
||||
$this->p->t('lehre', 'zgvMaster')
|
||||
. ' - ' .
|
||||
$this->p->t('ui', 'error_keineBerechtigungStg')
|
||||
);
|
||||
}
|
||||
|
||||
if(in_array($prestudent->studiengang_kz, $dokZgvStg))
|
||||
{
|
||||
$array_allowed_props_prestudent[] = 'zgvdoktor_code';
|
||||
}
|
||||
else if(!is_null($this->input->post('zgvdoktor_code')))
|
||||
{
|
||||
$this->terminateWithError(
|
||||
$this->p->t('lehre', 'zgvDoktor')
|
||||
. ' - ' .
|
||||
$this->p->t('ui', 'error_keineBerechtigungStg')
|
||||
);
|
||||
}
|
||||
|
||||
// add UDFs
|
||||
$result = $this->udflib->getDefinitionForModel($this->PrestudentModel);
|
||||
|
||||
|
||||
@@ -32,15 +32,15 @@ export default {
|
||||
},
|
||||
hasZGVBakkPermission: {
|
||||
from: 'hasZGVBakkPermission',
|
||||
default: false
|
||||
default: []
|
||||
},
|
||||
hasZGVMasterPermission: {
|
||||
from: 'hasZGVMasterPermission',
|
||||
default: false
|
||||
default: []
|
||||
},
|
||||
hasZGVDoctorPermission: {
|
||||
from: 'hasZGVDoctorPermission',
|
||||
default: false
|
||||
default: []
|
||||
},
|
||||
hasBismeldenPermission: {
|
||||
from: 'hasBismeldenPermission',
|
||||
@@ -89,6 +89,15 @@ export default {
|
||||
computed: {
|
||||
deltaLength() {
|
||||
return Object.keys(this.deltaArray).length;
|
||||
},
|
||||
disableZgvBakk: function() {
|
||||
return !this.hasZGVBakkPermission.includes(this.modelValue.studiengang_kz.toString());
|
||||
},
|
||||
disableZgvMaster: function() {
|
||||
return !this.hasZGVMasterPermission.includes(this.modelValue.studiengang_kz.toString());
|
||||
},
|
||||
disableZgvDoctor: function() {
|
||||
return !this.hasZGVDoctorPermission.includes(this.modelValue.studiengang_kz.toString());
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
@@ -289,7 +298,7 @@ export default {
|
||||
dropdown
|
||||
name="zgv_code"
|
||||
@complete="filterZgvs"
|
||||
:disabled="!hasZGVBakkPermission"
|
||||
:disabled="disableZgvBakk"
|
||||
>
|
||||
<template #option="slotProps">
|
||||
<div
|
||||
@@ -353,7 +362,7 @@ export default {
|
||||
dropdown
|
||||
name="zgvmas_code"
|
||||
@complete="filterMasterZgvs"
|
||||
:disabled="!hasZGVMasterPermission"
|
||||
:disabled="disableZgvMaster"
|
||||
>
|
||||
<template #option="slotProps">
|
||||
<div
|
||||
@@ -418,7 +427,7 @@ export default {
|
||||
dropdown
|
||||
name="zgvdoktor_code"
|
||||
@complete="filterDoktorZgvs"
|
||||
:disabled="!hasZGVDoctorPermission"
|
||||
:disabled="disableZgvDoctor"
|
||||
>
|
||||
<template #option="slotProps">
|
||||
<div
|
||||
|
||||
Reference in New Issue
Block a user