コード例 #1
0
ファイル: AlternateTest.php プロジェクト: rjsmelo/tiki
 function testWithReplacementNotAllowing()
 {
     $resolver = new Perms_Resolver_Default(false);
     $replacement = new Perms_Resolver_Static(array('Registered' => array('view', 'edit')));
     $check = new Perms_Check_Alternate('admin');
     $check->setResolver($replacement);
     $this->assertFalse($check->check($resolver, array(), 'view', array('Registered')));
 }
コード例 #2
0
 private function getExpect($categories = false, $indirectMap = array(), $globals = array())
 {
     $expect = new Perms();
     $expect->setPrefix('tiki_p_');
     $expect->setCheckSequence(array($globalAdminCheck = new Perms_Check_Alternate('admin'), $fixedResolverCheck = new Perms_Check_Fixed($globals), new Perms_Check_Direct(), new Perms_Check_Indirect($indirectMap)));
     $expect->setResolverFactories(array_values(array_filter(array(new Perms_ResolverFactory_ObjectFactory(), $categories ? new Perms_ResolverFactory_CategoryFactory() : null, new Perms_ResolverFactory_GlobalFactory()))));
     $resolver = $expect->getAccessor()->getResolver();
     $globalAdminCheck->setResolver($resolver);
     $fixedResolverCheck->setResolver($resolver);
     return $expect;
 }
コード例 #3
0
ファイル: AccessorTest.php プロジェクト: jkimdon/cohomeals
 function testApplicableGroupsThroughCheckSequence()
 {
     $accessor = new Perms_Accessor();
     $static = new Perms_Resolver_Static(array('Anonymous' => array('view'), 'Registered' => array('view', 'edit')));
     $global = new Perms_Resolver_Static(array('Admins' => array('admin')));
     $accessor->setResolver($static);
     $accessor->setCheckSequence(array($g = new Perms_Check_Alternate('admin'), new Perms_Check_Direct()));
     $g->setResolver($global);
     $this->assertEquals(array('Admins', 'Anonymous', 'Registered'), $accessor->applicableGroups());
 }