- If the sender of a message is an admin: show all the vorlage with
mimetype = text/html
 - If the sender of a message is NOT an admin: show all the
vorlage that belongs to the organisation units of the user
and the parents of those organisation units until the root
of the organisation unit tree

Changes:
 - Added method isAdminByPersonId to model Benutzerrolle_model
 - Added method _getAllHTMLVorlage to Vorlage_widget
 - Added method _getUserVorlage to Vorlage_widget
This commit is contained in:
Paolo
2017-06-06 15:21:22 +02:00
parent 02320f9388
commit 45b4c84764
5 changed files with 160 additions and 30 deletions
@@ -13,7 +13,7 @@ class Benutzerfunktion_model extends DB_Model
}
/**
*
* Get the Benutzerfunktion using the person_id
*/
public function getByPersonId($person_id)
{
@@ -1,7 +1,7 @@
<?php
class Benutzerrolle_model extends DB_Model
{
/**
* Constructor
*/
@@ -11,4 +11,29 @@ class Benutzerrolle_model extends DB_Model
$this->dbTable = 'system.tbl_benutzerrolle';
$this->pk = 'benutzerberechtigung_id';
}
}
/**
* Checks if the given user is an admin
*/
public function isAdminByPersonId($person_id)
{
// Join with the table tbl_benutzer
$this->addJoin('public.tbl_benutzer', 'uid');
$result = $this->loadWhere(array('person_id' => $person_id, 'rolle_kurzbz' => 'admin'));
if (!isError($result))
{
if (hasData($result))
{
$result = success(true);
}
else if (!hasData($result))
{
$result = success(false);
}
}
return $result;
}
}