[], 'groups_exclude' => [], 'users_include' => ['spots'], 'users_exclude' => [], ] ], [ 'mini:micro:nano:start', [ 'groups_include' => ['micra', 'nana'], 'groups_exclude' => [], 'users_include' => [], 'users_exclude' => [], ] ], [ 'mini:micro:start', [ 'groups_include' => ['user'], 'groups_exclude' => [], 'users_include' => [], 'users_exclude' => ['mirco'], ] ], [ 'super:start', [ 'groups_include' => ['ALL'], 'groups_exclude' => [], 'users_include' => [], 'users_exclude' => [], ] ], [ 'super:mini:start', [ 'groups_include' => [], 'groups_exclude' => [], 'users_include' => [], 'users_exclude' => [], ] ], [ 'super:mini:stop', [ 'groups_include' => ['nana'], 'groups_exclude' => [], 'users_include' => [], 'users_exclude' => [], ] ], ]; } /** * Run "normal" ACL checks to make sure we do expect the correct thing to happen * * This is mainly to sanity check the expectations we have for the results in the ACL checks * * @dataProvider dataSanity * @param string $page * @param string $user * @param string $group * @param int $expected */ public function testSanity($page, $user, $group, $expected) { global $AUTH_ACL; $AUTH_ACL = $this->acl; $this->assertSame($expected, auth_aclcheck($page, $user, [$group])); } /** * Check parsed ACLs for a given page * * @dataProvider dataACL * @param string $page * @param array $expected */ public function testACL($page, $expected) { global $AUTH_ACL; $AUTH_ACL = $this->acl; /** @var helper_plugin_elasticsearch_acl $helper */ $helper = plugin_load('helper', 'elasticsearch_acl'); $raw = $helper->getPageACL($page); $actual = $helper->splitRules($raw); $this->assertEquals($expected, $actual); } }