mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-23 18:03:17 +00:00
Merge pull request #396 from romainneutron/time-limit-sbas
[3.8] Time limit sbas
This commit is contained in:
@@ -133,6 +133,16 @@ class ControllerUsersTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
|
||||
$this->assertTrue($response->isOK());
|
||||
}
|
||||
|
||||
public function testRouteRightTimeSbas()
|
||||
{
|
||||
$sbas_id = self::$DI['record_1']->get_databox()->get_sbas_id();
|
||||
$params = array('sbas_id' => $sbas_id, 'users' => self::$DI['user']->get_id());
|
||||
|
||||
self::$DI['client']->request('POST', '/admin/users/rights/time/sbas/', $params);
|
||||
$response = self::$DI['client']->getResponse();
|
||||
$this->assertTrue($response->isOK());
|
||||
}
|
||||
|
||||
public function testRouteRightTimeApply()
|
||||
{
|
||||
$username = uniqid('user_');
|
||||
@@ -149,6 +159,37 @@ class ControllerUsersTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
|
||||
$user->delete();
|
||||
}
|
||||
|
||||
public function testRouteRightTimeApplySbas()
|
||||
{
|
||||
$username = uniqid('user_');
|
||||
$user = \User_Adapter::create(self::$DI['app'], $username, "test", $username . "@email.com", false);
|
||||
$sbas_id = self::$DI['record_1']->get_databox()->get_sbas_id();
|
||||
$date = new \Datetime();
|
||||
$date->modify("-10 days");
|
||||
$dmin = $date->format(DATE_ATOM);
|
||||
$date->modify("+30 days");
|
||||
$dmax = $date->format(DATE_ATOM);
|
||||
self::$DI['client']->request('POST', '/admin/users/rights/time/apply/', array('sbas_id' => $sbas_id, 'dmin' => $dmin, 'dmax' => $dmax, 'limit' => 1, 'users' => $user->get_id()));
|
||||
$response = self::$DI['client']->getResponse();
|
||||
$this->assertTrue($response->isOK());
|
||||
$user->delete();
|
||||
}
|
||||
|
||||
public function testRouteRightTimeApplyWithtoutBasOrSbas()
|
||||
{
|
||||
$username = uniqid('user_');
|
||||
$user = \User_Adapter::create(self::$DI['app'], $username, "test", $username . "@email.com", false);
|
||||
$date = new \Datetime();
|
||||
$date->modify("-10 days");
|
||||
$dmin = $date->format(DATE_ATOM);
|
||||
$date->modify("+30 days");
|
||||
$dmax = $date->format(DATE_ATOM);
|
||||
self::$DI['client']->request('POST', '/admin/users/rights/time/apply/', array('dmin' => $dmin, 'dmax' => $dmax, 'limit' => 1, 'users' => $user->get_id()));
|
||||
$response = self::$DI['client']->getResponse();
|
||||
$this->assertEquals(400, $response->getStatusCode());
|
||||
$user->delete();
|
||||
}
|
||||
|
||||
public function testRouteRightMask()
|
||||
{
|
||||
$keys = array_keys(self::$DI['user']->ACL()->get_granted_base());
|
||||
|
Reference in New Issue
Block a user