public function isTransitionAllowed(Reference $ref, $transition_name, $state = null, & $access_policy = null)
	{
		if ($state === null) {
			$state = $ref->state;
		}

		if ($transition_name == '') {
			// Read access
			$access_policy = $this->read_access_policy;
			return $this->checkAccessPolicy($this->read_access_policy, $ref);
		} else if (isset($this->actions[$transition_name]['transitions'][$state])) {
			$tr = $this->actions[$transition_name]['transitions'][$state];
			if (isset($tr['access_policy'])) {
				// Transition-specific policy
				$access_policy = $tr['access_policy'];
			} else if (isset($this->actions[$transition_name]['access_policy'])) {
				// Action-specific policy (for all transitions of this name)
				$access_policy = $this->actions[$transition_name]['access_policy'];
			} else {
				// No policy, use default
				$access_policy = $this->default_access_policy;
			}
			return $this->checkAccessPolicy($access_policy, $ref);
		} else {
			// Not a valid transition
			return false;
		}
	}
public function isTransitionAllowed(Reference $ref, $transition_name, $state = null, & $access_policy = null)
	{
		if ($state === null) {
			$state = $ref->state;
		}

		if ($transition_name == '') {
			// Read access
			$access_policy = $this->read_access_policy;
			return $this->checkAccessPolicy($this->read_access_policy, $ref);
		} else if (isset($this->actions[$transition_name]['transitions'][$state])) {
			$tr = $this->actions[$transition_name]['transitions'][$state];
			if (isset($tr['access_policy'])) {
				// Transition-specific policy
				$access_policy = $tr['access_policy'];
			} else if (isset($this->actions[$transition_name]['access_policy'])) {
				// Action-specific policy (for all transitions of this name)
				$access_policy = $this->actions[$transition_name]['access_policy'];
			} else {
				// No policy, use default
				$access_policy = $this->default_access_policy;
			}
			return $this->checkAccessPolicy($access_policy, $ref);
		} else {
			// Not a valid transition
			return false;
		}
	}
public function isTransitionAllowed ( Reference $ ref , $ transition_name , $ state = null , & $ access_policy = null ) { if ( $ state === null ) { $ state = $ ref -> state ; } if ( $ transition_name == '' ) { // Read access $ access_policy = $ this -> read_access_policy ; return $ this -> checkAccessPolicy ( $ this -> read_access_policy , $ ref ) ; } else if ( isset ( $ this -> actions [ $ transition_name ] [ 'transitions' ] [ $ state ] ) ) { $ tr = $ this -> actions [ $ transition_name ] [ 'transitions' ] [ $ state ] ; if ( isset ( $ tr [ 'access_policy' ] ) ) { // Transition-specific policy $ access_policy = $ tr [ 'access_policy' ] ; } else if ( isset ( $ this -> actions [ $ transition_name ] [ 'access_policy' ] ) ) { // Action-specific policy (for all transitions of this name) $ access_policy = $ this -> actions [ $ transition_name ] [ 'access_policy' ] ; } else { // No policy, use default $ access_policy = $ this -> default_access_policy ; } return $ this -> checkAccessPolicy ( $ access_policy , $ ref ) ; } else { // Not a valid transition return false ; } }
Returns true if transition can be invoked right now.

TODO: Transition should not have full definition of the policy, only
its name. Definitions should be in common place.
Returns true if transition can be invoked right now .