icingadb-web/library/Icingadb/Common/Model.php
Johannes Meyer 5e982dad40
Merge commit from fork
* Auth: Add method `assertColumnRestrictions`

* ObjectSuggestions: Do not suggest protected variables

`assertColumnRestrictions` does not allow to use them
anymore, hence we should not suggest them in searches
as well to not to let the user run into an error by
accepting a suggestion. Though, when fetching values
as well, we still have to obfuscate, otherwise protected
vars won't show up in details anymore.

* Introduce Icinga\Module\Icingadb\Common\Model

Must be used as base for all models, to ensure
column restrictions are asserted on filters.

* Utilize `Icinga\Module\Icingadb\Common\Model` where applicable
2025-10-16 08:42:51 +02:00

27 lines
576 B
PHP

<?php
/* Icinga DB Web | (c) 2025 Icinga GmbH | GPLv2 */
namespace Icinga\Module\Icingadb\Common;
use ipl\Orm\Query;
use ipl\Sql\Connection;
abstract class Model extends \ipl\Orm\Model
{
public static function on(Connection $db)
{
$query = parent::on($db);
return $query->on(
Query::ON_SELECT_ASSEMBLED,
function () use ($query) {
$auth = new class () {
use Auth;
};
$auth->assertColumnRestrictions($query->getFilter());
}
);
}
}