Changed permission function to allow stgl assistance download on Uebersicht- and Detailseite

This commit is contained in:
Cris
2022-02-21 16:53:30 +01:00
parent d2055f759e
commit b1f171aee2
2 changed files with 44 additions and 14 deletions
@@ -471,21 +471,35 @@ class approveAnrechnungDetail extends Auth_Controller
'lehrveranstaltung_id' => $result->lehrveranstaltung_id
));
if(!$result = getData($result)[0])
{
show_error('Failed loading Lehrveranstaltung');
}
$studiengang_kz = getData($result)[0]->studiengang_kz;
// Get STGL
$result = $this->StudiengangModel->getLeitung($result->studiengang_kz);
$result = $this->StudiengangModel->getLeitung($studiengang_kz);
if($result = getData($result)[0])
{
if ($result->uid == $this->_uid)
{
return;
}
}
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))
{
foreach (getData($result) as $assistance)
{
if ($assistance->uid == $this->_uid)
{
return;
}
}
}
show_error('You are not entitled to read this document');
}
@@ -281,9 +281,11 @@ class approveAnrechnungUebersicht extends Auth_Controller
{
show_error('Failed loading Lehrveranstaltung');
}
$studiengang_kz = $result->studiengang_kz;
// Get STGL
$result = $this->StudiengangModel->getLeitung($result->studiengang_kz);
// Check if user is STGL
$result = $this->StudiengangModel->getLeitung($studiengang_kz);
if (hasData($result))
{
@@ -295,6 +297,20 @@ class approveAnrechnungUebersicht extends Auth_Controller
}
}
}
// 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');
}