public function isAllowed($entity, $operation)
    {
        //fallback to global rules if entity wasn't specified in the rules
        $lookupEn = array_key_exists($entity, $this->operationList)
                            ? $entity
                            : self::ALL;

        //fallback to global rules if operation wasn't specified in the rules
        $lookupOp = array_key_exists($operation, $this->operationList[$lookupEn])
                            ? $operation
                            : self::ALL;

        // entity and operation were found as is
        if (($entity === $lookupEn) && ($operation === $lookupOp)) {
            return $this->operationList[$lookupEn][$lookupOp];
        }

        //lookup for operation for current entity if it exists
        if (array_key_exists($lookupOp, $this->operationList[$lookupEn])) {
            return $this->operationList[$lookupEn][$lookupOp];
        }

        //lookup for operation for current entity if it exists
        if (array_key_exists($operation, $this->operationList[self::ALL])) {
            return $this->operationList[self::ALL][$operation];
        }

        //fallback to global entity
        if (array_key_exists($lookupOp, $this->operationList[self::ALL])) {
            return $this->operationList[self::ALL][$lookupOp];
        }

        //fall back to global entity and operation
        return $this->operationList[self::ALL][self::ALL];
    }
public function isAllowed($entity, $operation)
    {
        //fallback to global rules if entity wasn't specified in the rules
        $lookupEn = array_key_exists($entity, $this->operationList)
                            ? $entity
                            : self::ALL;

        //fallback to global rules if operation wasn't specified in the rules
        $lookupOp = array_key_exists($operation, $this->operationList[$lookupEn])
                            ? $operation
                            : self::ALL;

        // entity and operation were found as is
        if (($entity === $lookupEn) && ($operation === $lookupOp)) {
            return $this->operationList[$lookupEn][$lookupOp];
        }

        //lookup for operation for current entity if it exists
        if (array_key_exists($lookupOp, $this->operationList[$lookupEn])) {
            return $this->operationList[$lookupEn][$lookupOp];
        }

        //lookup for operation for current entity if it exists
        if (array_key_exists($operation, $this->operationList[self::ALL])) {
            return $this->operationList[self::ALL][$operation];
        }

        //fallback to global entity
        if (array_key_exists($lookupOp, $this->operationList[self::ALL])) {
            return $this->operationList[self::ALL][$lookupOp];
        }

        //fall back to global entity and operation
        return $this->operationList[self::ALL][self::ALL];
    }
public function isAllowed ( $ entity , $ operation ) { //fallback to global rules if entity wasn't specified in the rules $ lookupEn = array_key_exists ( $ entity , $ this -> operationList ) ? $ entity : self :: ALL ; //fallback to global rules if operation wasn't specified in the rules $ lookupOp = array_key_exists ( $ operation , $ this -> operationList [ $ lookupEn ] ) ? $ operation : self :: ALL ; // entity and operation were found as is if ( ( $ entity === $ lookupEn ) && ( $ operation === $ lookupOp ) ) { return $ this -> operationList [ $ lookupEn ] [ $ lookupOp ] ; } //lookup for operation for current entity if it exists if ( array_key_exists ( $ lookupOp , $ this -> operationList [ $ lookupEn ] ) ) { return $ this -> operationList [ $ lookupEn ] [ $ lookupOp ] ; } //lookup for operation for current entity if it exists if ( array_key_exists ( $ operation , $ this -> operationList [ self :: ALL ] ) ) { return $ this -> operationList [ self :: ALL ] [ $ operation ] ; } //fallback to global entity if ( array_key_exists ( $ lookupOp , $ this -> operationList [ self :: ALL ] ) ) { return $ this -> operationList [ self :: ALL ] [ $ lookupOp ] ; } //fall back to global entity and operation return $ this -> operationList [ self :: ALL ] [ self :: ALL ] ; }
Verifies if operation is available for some entity
@param string $entity
@param string $operation
@return bool
Verifies if operation is available for some entity