Exemple #1
0
 function testGroupsPropagateToAccessor()
 {
     $perms = new Perms();
     $perms->setGroups(array('Registered', 'Administrator'));
     Perms::set($perms);
     $expect = new Perms_Accessor();
     $expect->setGroups(array('Registered', 'Administrator'));
     $this->assertEquals($expect, Perms::get());
 }
Exemple #2
0
 private function getTrackerPermissions()
 {
     if ($this->definition) {
         $trackerId = $this->definition->getConfiguration('trackerId');
         return Perms::get('tracker', $trackerId);
     }
     $accessor = new Perms_Accessor();
     $accessor->setResolver(new Perms_Resolver_Default(false));
     return $accessor;
 }
Exemple #3
0
 public function getAccessor(array $context = array())
 {
     $accessor = new Perms_Accessor();
     $accessor->setContext($context);
     $accessor->setPrefix($this->prefix);
     $accessor->setGroups($this->groups);
     if ($this->checkSequence) {
         $accessor->setCheckSequence($this->checkSequence);
     }
     if ($resolver = $this->getResolver($context)) {
         $accessor->setResolver($resolver);
     }
     return $accessor;
 }
Exemple #4
0
 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());
 }