Compare commits

...
6 changed files with 48 additions and 107 deletions
@@ -198,7 +198,7 @@ class Grades extends FHCAPI_Controller
$now = date('c');
// NOTE(chris): Stg Permissions
if (!$this->hasPermissionUpdate($lehrveranstaltung_id, $student_uid))
if (!$this->hasPermissionGradeUID($lehrveranstaltung_id, $student_uid))
return $this->_outputAuthError([$this->router->method => ['admin', 'assistenz']]);
$this->load->model('education/Zeugnisnote_model', 'ZeugnisnoteModel');
@@ -260,7 +260,7 @@ class Grades extends FHCAPI_Controller
$lehrveranstaltung_id = $this->input->post('lehrveranstaltung_id');
// NOTE(chris): Stg Permissions
if (!$this->hasPermissionDelete($lehrveranstaltung_id, $student_uid))
if (!$this->hasPermissionGradeUID($lehrveranstaltung_id, $student_uid))
return $this->_outputAuthError([$this->router->method => ['admin', 'assistenz']]);
$this->load->model('education/Zeugnisnote_model', 'ZeugnisnoteModel');
@@ -298,7 +298,7 @@ class Grades extends FHCAPI_Controller
$authUID = getAuthUID();
// NOTE(chris): Stg Permissions
if (!$this->hasPermissionCopy($lehrveranstaltung_id, $student_uid))
if (!$this->hasPermissionGradeUID($lehrveranstaltung_id, $student_uid))
return $this->_outputAuthError([$this->router->method => 'student/noten']);
$this->load->model('education/Lvgesamtnote_model', 'LvgesamtnoteModel');
@@ -410,7 +410,7 @@ class Grades extends FHCAPI_Controller
$repeaterGrade = current($repeaterGrade);
// NOTE(chris): Stg Permissions
if (!$this->hasPermissionCopy($repeaterGrade->lehrveranstaltung_id, $repeaterGrade->student_uid))
if (!$this->hasPermissionGradeUID($repeaterGrade->lehrveranstaltung_id, $repeaterGrade->student_uid))
return $this->_outputAuthError([$this->router->method => 'student/noten']);
$data = [
@@ -565,136 +565,57 @@ class Grades extends FHCAPI_Controller
}
/**
* Helper function to check permissions for updateCertificate()
* Combined helper function to check permissions for
* certificate-modifying functions
*
* @param integer $lehrveranstaltung_id
* @param string $student_uid
*
* @return boolean
*/
protected function hasPermissionUpdate($lehrveranstaltung_id, $student_uid)
protected function hasPermissionGradeUID($lehrveranstaltung_id, $student_uid)
{
if ($lehrveranstaltung_id === null || $student_uid === null)
return true;
$this->load->model('crm/Student_model', 'StudentModel');
$result = $this->StudentModel->load([$student_uid]);
if (isError($result) || !hasData($result))
$studentResult = $this->StudentModel->load([$student_uid]);
if (isError($studentResult) || !hasData($studentResult))
return false;
$student = current(getData($result));
$student = current(getData($studentResult));
if ($this->permissionlib->isBerechtigt('admin', 'suid', $student->studiengang_kz))
return true;
if ($this->permissionlib->isBerechtigt('assistenz', 'suid', $student->studiengang_kz))
return true;
$this->load->model('organisation/Studienplan_model', 'StudienplanModel');
$result = $this->StudienplanModel->getAllOesForLv($lehrveranstaltung_id);
if (isError($result))
$oesResult = $this->StudienplanModel->getAllOesForLv($lehrveranstaltung_id);
if (isError($oesResult))
return false;
$oes = getData($result) ?: [];
$oes = hasData($oesResult) ? getData($oesResult) : [];
$this->load->model('education/Lehrveranstaltung_model', 'LehrveranstaltungModel');
$result = $this->LehrveranstaltungModel->getStg($lehrveranstaltung_id);
if (isError($result))
$lvResult = $this->LehrveranstaltungModel->load($lehrveranstaltung_id);
if (isError($lvResult))
return false;
if (hasData($result))
$oes[] = current(getData($result));
if (hasData($lvResult))
$oes[] = current(getData($lvResult));
if ($this->permissionlib->isBerechtigt('student/noten', 'suid', $student->studiengang_kz))
return true;
foreach ($oes as $oe) {
if ($this->permissionlib->isBerechtigt('admin', 'suid', $oe->oe_kurzbz))
if ($this->permissionlib->isBerechtigt('student/noten', 'suid', $oe->oe_kurzbz))
return true;
if ($this->permissionlib->isBerechtigt('assistenz', 'suid', $oe->oe_kurzbz))
if ($this->permissionlib->isBerechtigt('student/noten', 'suid', $oe->studiengang_kz))
return true;
}
return false;
}
/**
* Helper function to check permissions for deleteCertificate()
*
* @param integer $lehrveranstaltung_id
* @param string $student_uid
*
* @return boolean
*/
protected function hasPermissionDelete($lehrveranstaltung_id, $student_uid)
{
if ($lehrveranstaltung_id === null || $student_uid === null)
return true;
$this->load->model('crm/Student_model', 'StudentModel');
$result = $this->StudentModel->load([$student_uid]);
if (isError($result) || !hasData($result))
return false;
$student = current(getData($result));
if ($this->permissionlib->isBerechtigt('admin', 'suid', $student->studiengang_kz))
return true;
if ($this->permissionlib->isBerechtigt('assistenz', 'suid', $student->studiengang_kz))
return true;
$this->load->model('education/Lehrveranstaltung_model', 'LehrveranstaltungModel');
$result = $this->LehrveranstaltungModel->load($lehrveranstaltung_id);
if (isError($result) || !hasData($result))
return false;
$oe = current(getData($result));
if ($this->permissionlib->isBerechtigt('admin', 'suid', $oe->oe_kurzbz))
return true;
if ($this->permissionlib->isBerechtigt('assistenz', 'suid', $oe->oe_kurzbz))
return true;
return false;
}
/**
* Helper function to check permissions for
* copyTeacherProposalToCertificate() and copyRepeaterGradeToCertificate()
*
* @param integer $lehrveranstaltung_id
* @param string $student_uid
*
* @return boolean
*/
protected function hasPermissionCopy($lehrveranstaltung_id, $student_uid)
{
if ($lehrveranstaltung_id === null || $student_uid === null)
return true;
$this->load->model('crm/Student_model', 'StudentModel');
$result = $this->StudentModel->load([$student_uid]);
if (isError($result) || !hasData($result))
return false;
$student = current(getData($result));
if ($this->permissionlib->isBerechtigt('student/noten', 'suid', $student->studiengang_kz))
return true;
$this->load->model('education/Lehrveranstaltung_model', 'LehrveranstaltungModel');
$result = $this->LehrveranstaltungModel->load($lehrveranstaltung_id);
if (isError($result) || !hasData($result))
return false;
$oe = current(getData($result));
if ($this->permissionlib->isBerechtigt('student/noten', 'suid', $oe->oe_kurzbz))
return true;
return false;
}
}
@@ -57,7 +57,7 @@
<div class="row<?php if ($lockedbyother) echo ' alert-danger' ?>">
<div class="col-lg-8">
<h3 class="page-header">
Infocenter Details: <a target="_blank" title="Studentenverwaltung" href="<?php echo site_url('/Studentenverwaltung/' . $studiensemester . '/person/' . $stammdaten->person_id) ?>"><?php echo $stammdaten->vorname.' '.$stammdaten->nachname ?> <i class="fa fa-external-link" style="font-size:small"></i></a>
Infocenter Details: <a target="_blank" title="Studentenverwaltung" href="<?php echo site_url('/studvw/stdsem/' . $studiensemester . '/person/' . $stammdaten->person_id) ?>"><?php echo $stammdaten->vorname.' '.$stammdaten->nachname ?> <i class="fa fa-external-link" style="font-size:small"></i></a>
</h3>
</div>
<div class="col-lg-4">
+1 -1
View File
@@ -351,7 +351,7 @@ if (!$berechtigung->isBerechtigt('admin')
{
$worksheet->write($lines,3,$elem->vorname);
}
$worksheet->write($lines,4,$elem->semester.$elem->verband.$elem->gruppe);
$worksheet->writeString($lines,4,$elem->semester.$elem->verband.$elem->gruppe);
$worksheet->write($lines,5,trim($elem->matrikelnr),$format_highlight);
$worksheet->write($lines,6, $note, $format_highlightright);
+1 -1
View File
@@ -121,7 +121,7 @@ class vertrag extends basis_db
JOIN lehre.tbl_lehreinheit USING(lehreinheit_id)
WHERE
vertrag_id=tbl_vertrag.vertrag_id
AND studiensemester_kurzbz in (SELECT studiensemester_kurzbz FROM public.tbl_studiensemester WHERE start>=".$this->db_add_param($datum).")
AND studiensemester_kurzbz in (SELECT studiensemester_kurzbz FROM public.tbl_studiensemester WHERE start>".$this->db_add_param($datum).")
)
)";
}
@@ -255,7 +255,7 @@ export default {
deleteButton.className = 'btn btn-outline-secondary';
const icon = document.createElement('i');
icon.className = 'fa fa-trash';
icon.title = this.$p.t('ui/loeschen');
icon.title = this.$p.t('lehre/info_deleteMarkEntry');
deleteButton.append(icon);
deleteButton.addEventListener('click', evt => {
evt.stopPropagation();
+20
View File
@@ -62411,6 +62411,26 @@ I have been informed that I am under no obligation to consent to the transmissio
)
)
),
array(
'app' => 'core',
'category' => 'lehre',
'phrase' => 'info_deleteMarkEntry',
'insertvon' => 'system',
'phrases' => array(
array(
'sprache' => 'German',
'text' => 'Noteneintrag entfernen',
'description' => '',
'insertvon' => 'system'
),
array(
'sprache' => 'English',
'text' => 'Remove grade entry',
'description' => '',
'insertvon' => 'system'
)
)
),
);