mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-07-25 08:34:29 +00:00
Merge branch 'master' into udf
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user