modifs.mineures sans commentaires

This commit is contained in:
Jephté Clain 2024-06-21 21:43:32 +04:00
parent be128e0389
commit 18b05b7ed7
4 changed files with 8 additions and 6 deletions

View File

@ -58,6 +58,6 @@ class authz {
static final function get_auth(): string { return self::manager()->getAuth(); } static final function get_auth(): string { return self::manager()->getAuth(); }
static final function get(): IAuthzUser { return self::manager()->getUser(); } static final function get(): IAuthzUser { return self::manager()->getUser(); }
static final function is_root(): bool { return self::get()->isRole("root"); } static final function is_root(): bool { return self::get()->isPerm("*"); }
static final function is_admin(): bool { return self::get()->isRole("admin"); } static final function is_admin(): bool { return self::get()->isPerm("admin"); }
} }

View File

@ -165,7 +165,7 @@ abstract class Application {
static::_app_configure($app); static::_app_configure($app);
static::_app_main($app); static::_app_main($app);
} catch (ExitException $e) { } catch (ExitException $e) {
msg::error($e); if ($e->haveMessage()) msg::error($e);
exit($e->getCode()); exit($e->getCode());
} catch (Exception $e) { } catch (Exception $e) {
msg::error($e); msg::error($e);

View File

@ -177,8 +177,8 @@ class CapacitorChannel {
* Avant d'utiliser un id pour rechercher dans la base de donnée, corriger sa * Avant d'utiliser un id pour rechercher dans la base de donnée, corriger sa
* valeur le cas échéant. * valeur le cas échéant.
* *
* Cette fonction assume que l'unique clé primaire est "id_". Elle n'est pas * Cette fonction assume que la clé primaire n'est pas multiple. Elle n'est
* utilisée si une clé primaire multiple est définie. * pas utilisée si une clé primaire multiple est définie.
*/ */
function verifixId(string &$id): void { function verifixId(string &$id): void {
} }

View File

@ -204,6 +204,7 @@ EOT;
$this->_create($channel); $this->_create($channel);
$tableName = $channel->getTableName(); $tableName = $channel->getTableName();
$db = $this->db(); $db = $this->db();
$args ??= [];
$initFunc = [$channel, "getItemValues"]; $initFunc = [$channel, "getItemValues"];
$initArgs = $args; $initArgs = $args;
@ -359,9 +360,10 @@ EOT;
protected function verifixFilter(CapacitorChannel $channel, &$filter): void { protected function verifixFilter(CapacitorChannel $channel, &$filter): void {
if ($filter !== null && !is_array($filter)) { if ($filter !== null && !is_array($filter)) {
$primaryKeys = $this->getPrimaryKeys($channel);
$id = $filter; $id = $filter;
$channel->verifixId($id); $channel->verifixId($id);
$filter = ["id_" => $id]; $filter = [$primaryKeys[0] => $id];
} }
$cols = $this->ColumnDefinitions($channel); $cols = $this->ColumnDefinitions($channel);
if ($filter !== null) { if ($filter !== null) {