DbUserGroupBackend: Properly utilize the insert and update capability

refs #8826
This commit is contained in:
Johannes Meyer 2015-05-11 13:28:01 +02:00
parent ca166b0175
commit b3957c556b
1 changed files with 38 additions and 0 deletions

View File

@ -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
*