Exemple #1
0
 /**
  * Returns authorized states for an object using the state mapping.
  *
  * @return array(<string>)
  */
 public function getAuthorizedStates()
 {
     $authorizationMask = $this->graph->getAuthorizationMask($this->object);
     $objectState = $this->graph->getState($this->readProperty());
     $states = array();
     foreach ($this->graph->getStates() as $key => $state) {
         if ($objectState->isAllow($state, $this->graph, $authorizationMask)) {
             $states[] = $key;
         }
     }
     return $states;
 }
Exemple #2
0
 /**
  * {@inheritdoc}
  */
 public function isAllow(StateInterface $state, Graph $graph, $authorizationMask)
 {
     $acceptedMasks = 0;
     foreach ($this->stateKeys as $stateKey) {
         $acceptedMasks |= $graph->getState($stateKey)->getMask();
     }
     return parent::isAllow($state, $graph, $authorizationMask) && ($state->getMask() & $acceptedMasks) === $state->getMask();
 }
Exemple #3
0
 /**
  * {@inheritdoc}
  */
 public function isAllow(StateInterface $state, Graph $graph, $authorizationMask)
 {
     $untilMask = $graph->getState($this->untilKey)->getMask();
     return parent::isAllow($state, $graph, $authorizationMask) && $this->getMask() < $state->getMask() && $state->getMask() <= $untilMask;
 }