IniUserGroupBackend: Extend IniRepository

We are now able to insert, update and delete user groups stored in INI files

refs #8826
This commit is contained in:
Johannes Meyer 2015-05-08 15:26:35 +02:00
parent 6ef4bbe210
commit 59ec11f047

View File

@ -3,11 +3,13 @@
namespace Icinga\Authentication\UserGroup; namespace Icinga\Authentication\UserGroup;
use Icinga\Repository\Repository; use Icinga\Exception\StatementException;
use Icinga\Data\Filter\Filter;
use Icinga\Repository\IniRepository;
use Icinga\User; use Icinga\User;
use Icinga\Util\String; use Icinga\Util\String;
class IniUserGroupBackend extends Repository implements UserGroupBackendInterface class IniUserGroupBackend extends IniRepository implements UserGroupBackendInterface
{ {
/** /**
* The query columns being provided * The query columns being provided
@ -55,6 +57,35 @@ class IniUserGroupBackend extends Repository implements UserGroupBackendInterfac
$this->ds->getConfigObject()->setKeyColumn('name'); $this->ds->getConfigObject()->setKeyColumn('name');
} }
/**
* Add a new group to this backend
*
* @param string $target
* @param array $data
*
* @throws StatementException In case the operation has failed
*/
public function insert($target, array $data)
{
$data['created_at'] = time();
parent::insert($target, $data);
}
/**
* Update groups of this backend, optionally limited using a filter
*
* @param string $target
* @param array $data
* @param Filter $filter
*
* @throws StatementException In case the operation has failed
*/
public function update($target, array $data, Filter $filter = null)
{
$data['last_modified'] = time();
parent::update($target, $data, $filter);
}
/** /**
* Return the groups the given user is a member of * Return the groups the given user is a member of
* *