adds isMitarbeiter to the new Profil FhcAPIController

This commit is contained in:
SimonGschnell
2024-07-18 09:36:30 +02:00
parent fdd3026212
commit 29aa7f5056
3 changed files with 29 additions and 85 deletions
@@ -36,6 +36,7 @@ class Profil extends FHCAPI_Controller
'fotoSperre' => self::PERM_LOGGED,
'getGemeinden' => self::PERM_LOGGED,
'getAllNationen' => self::PERM_LOGGED,
'isMitarbeiter' => self::PERM_LOGGED,
]);
@@ -160,7 +161,7 @@ class Profil extends FHCAPI_Controller
$nation_res = $this->NationModel->load();
if (isError($nation_res)) {
show_error("error while trying to query table codex.tbl_nation");
$this->terminateWithError("error while trying to query table codex.tbl_nation", self::ERROR_TYPE_GENERAL);
}
$nation_res = $this->getDataOrTerminateWithError($nation_res);
@@ -278,6 +279,29 @@ class Profil extends FHCAPI_Controller
return $res;
}
/**
* checks whether a specific userID is a mitarbeiter or not (foreword declaration of the function isMitarbeiter in Mitarbeiter_model.php)
* @access public
* @param $uid the userID used to check if it is a mitarbeiter
* @return boolean
*/
public function isMitarbeiter($uid)
{
if(!$uid) $this->terminateWithError("No uid provided", self::ERROR_TYPE_GENERAL);
$result = $this->MitarbeiterModel->isMitarbeiter($uid);
if (isError($result)) {
$this->terminateWithError("error when calling Mitarbeiter_model function isMitarbeiter with uid " . $uid, self::ERROR_TYPE_GENERAL);
}
$result = $this->getDataOrTerminateWithError($result);
$this->terminateWithSuccess($result);
}
/**
* function that returns the data used for the mitarbeiter profile
* @access private