From b3957c556be2a25242b16069c0517581aba8e495 Mon Sep 17 00:00:00 2001 From: Johannes Meyer Date: Mon, 11 May 2015 13:28:01 +0200 Subject: [PATCH] DbUserGroupBackend: Properly utilize the insert and update capability refs #8826 --- .../UserGroup/DbUserGroupBackend.php | 38 +++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/library/Icinga/Authentication/UserGroup/DbUserGroupBackend.php b/library/Icinga/Authentication/UserGroup/DbUserGroupBackend.php index 32d65ab53..1e4ad395e 100644 --- a/library/Icinga/Authentication/UserGroup/DbUserGroupBackend.php +++ b/library/Icinga/Authentication/UserGroup/DbUserGroupBackend.php @@ -3,6 +3,7 @@ namespace Icinga\Authentication\UserGroup; +use Icinga\Data\Filter\Filter; use Icinga\Repository\DbRepository; use Icinga\User; @@ -24,6 +25,18 @@ class DbUserGroupBackend extends DbRepository implements UserGroupBackendInterfa ) ); + /** + * The statement columns being provided + * + * @var array + */ + protected $statementColumns = array( + 'group' => array( + 'created_at' => 'ctime', + 'last_modified' => 'mtime' + ) + ); + /** * The columns which are not permitted to be queried * @@ -55,6 +68,31 @@ class DbUserGroupBackend extends DbRepository implements UserGroupBackendInterfa } } + /** + * Insert a table row with the given data + * + * @param string $table + * @param array $bind + */ + public function insert($table, array $bind) + { + $bind['created_at'] = date('Y-m-d H:i:s'); + parent::insert($table, $bind); + } + + /** + * Update table rows with the given data, optionally limited by using a filter + * + * @param string $table + * @param array $bind + * @param Filter $filter + */ + public function update($table, array $bind, Filter $filter = null) + { + $bind['last_modified'] = date('Y-m-d H:i:s'); + parent::update($table, $bind, $filter); + } + /** * Return the groups the given user is a member of *