PHRAS-508_acl-cache

- wip
This commit is contained in:
Jean-Yves Gaulier
2016-10-25 17:15:20 +02:00
parent 6a2285f66d
commit 642da0fca5
56 changed files with 446 additions and 418 deletions

View File

@@ -138,7 +138,7 @@ class DataboxTest extends \PhraseanetAuthenticatedWebTestCase
'has_right_on_sbas'=> function (\PHPUnit_Framework_MockObject_MockObject $acl) {
$acl->expects($this->once())
->method('has_right_on_sbas')
->with($this->equalTo(self::$DI['collection']->get_sbas_id()), 'bas_modify_struct')
->with($this->equalTo(self::$DI['collection']->get_sbas_id()), \ACL::BAS_MODIFY_STRUCT)
->will($this->returnValue(false));
}
]);
@@ -157,7 +157,7 @@ class DataboxTest extends \PhraseanetAuthenticatedWebTestCase
'has_right_on_sbas'=> function (\PHPUnit_Framework_MockObject_MockObject $acl) {
$acl->expects($this->once())
->method('has_right_on_sbas')
->with($this->equalTo(self::$DI['collection']->get_sbas_id()), 'bas_modify_struct')
->with($this->equalTo(self::$DI['collection']->get_sbas_id()), \ACL::BAS_MODIFY_STRUCT)
->will($this->returnValue(true));
}
]);
@@ -191,7 +191,7 @@ class DataboxTest extends \PhraseanetAuthenticatedWebTestCase
'has_right_on_sbas'=> function (\PHPUnit_Framework_MockObject_MockObject $acl) {
$acl->expects($this->once())
->method('has_right_on_sbas')
->with($this->equalTo(self::$DI['collection']->get_sbas_id()), 'bas_modify_struct')
->with($this->equalTo(self::$DI['collection']->get_sbas_id()), \ACL::BAS_MODIFY_STRUCT)
->will($this->returnValue(true));
}
]);

View File

@@ -342,10 +342,10 @@ class UsersTest extends \PhraseanetAuthenticatedWebTestCase
foreach (self::$DI['app']->getDataboxes() as $databox) {
$rights = [
'bas_manage' => '1'
, 'bas_modify_struct' => '1'
, 'bas_modif_th' => '1'
, 'bas_chupub' => '1'
\ACL::BAS_MANAGE => '1',
\ACL::BAS_MODIFY_STRUCT => '1',
\ACL::BAS_MODIF_TH => '1',
\ACL::BAS_CHUPUB => '1',
];
self::$DI['app']->getAclForUser($user)->update_rights_to_sbas($databox->get_sbas_id(), $rights);

View File

@@ -18,7 +18,7 @@ class StoryTest extends \PhraseanetAuthenticatedWebTestCase
$route = "/prod/story/";
$collections = self::$DI['app']->getAclForUser(self::$DI['app']->getAuthenticatedUser())
->get_granted_base(['canaddrecord']);
->get_granted_base([\ACL::CANADDRECORD]);
$collection = array_shift($collections);
@@ -47,7 +47,7 @@ class StoryTest extends \PhraseanetAuthenticatedWebTestCase
$route = "/prod/story/";
$collections = self::$DI['app']->getAclForUser(self::$DI['app']->getAuthenticatedUser())
->get_granted_base(['canaddrecord']);
->get_granted_base([\ACL::CANADDRECORD]);
$collection = array_shift($collections);

View File

@@ -79,7 +79,7 @@ class RecordsRequestTest extends \PhraseanetAuthenticatedTestCase
public function testSimpleWithoutSbasRights()
{
self::$DI['app']->getAclForUser(self::$DI['app']->getAuthenticatedUser())
->update_rights_to_sbas(self::$DI['record_2']->get_sbas_id(), ['bas_chupub' => 0]);
->update_rights_to_sbas(self::$DI['record_2']->get_sbas_id(), [\ACL::BAS_CHUPUB => 0]);
$request = new Request([
'lst' => implode(';', [
@@ -87,7 +87,7 @@ class RecordsRequestTest extends \PhraseanetAuthenticatedTestCase
])
]);
$records = RecordsRequest::fromRequest(self::$DI['app'], $request, false, [], ['bas_chupub']);
$records = RecordsRequest::fromRequest(self::$DI['app'], $request, false, [], [\ACL::BAS_CHUPUB]);
$this->assertEquals(0, count($records));
$this->assertEquals(1, count($records->received()));