protected function load_rights_sbas()
    {

        if ($this->_rights_sbas && $this->_global_rights) {
            return $this;
        }

        try {
            $global_rights = $this->get_data_from_cache(self::CACHE_GLOBAL_RIGHTS);
            if (!is_array($global_rights)) {
                throw new Exception('global rights were not properly retrieved');
            }
            $sbas_rights = $this->get_data_from_cache(self::CACHE_RIGHTS_SBAS);
            if (!is_array($sbas_rights)) {
                throw new Exception('sbas rights were not properly retrieved');
            }

            $this->_global_rights = $global_rights;
            $this->_rights_sbas = $sbas_rights;

            return $this;
        } catch (\Exception $e) {
            // no-op
        }

        $sql = "SELECT sbasusr.* FROM sbasusr INNER JOIN sbas USING(sbas_id) WHERE usr_id= :usr_id";

        $stmt = $this->app->getApplicationBox()->get_connection()->prepare($sql);
        $stmt->execute([':usr_id' => $this->user->getId()]);
        $rs = $stmt->fetchAll(PDO::FETCH_ASSOC);
        $stmt->closeCursor();

        $this->_rights_sbas = [];

        foreach(self::$sbas_rights as $b) {
            $this->_global_rights[$b] = false;
        }

        foreach ($rs as $row) {
            $sbid = $row['sbas_id'];
            $this->_rights_sbas[$sbid] = [];
            foreach (self::$sbas_rights as $b) {
                $this->_global_rights[$b] = ($this->_rights_sbas[$sbid][$b] = ($row[$b] == '1')) || $this->_global_rights[$b];
            }
        }
        $this->set_data_to_cache($this->_rights_sbas, self::CACHE_RIGHTS_SBAS);
        $this->set_data_to_cache($this->_global_rights, self::CACHE_GLOBAL_RIGHTS);

        return $this;
    }
protected function load_rights_sbas()
    {

        if ($this->_rights_sbas && $this->_global_rights) {
            return $this;
        }

        try {
            $global_rights = $this->get_data_from_cache(self::CACHE_GLOBAL_RIGHTS);
            if (!is_array($global_rights)) {
                throw new Exception('global rights were not properly retrieved');
            }
            $sbas_rights = $this->get_data_from_cache(self::CACHE_RIGHTS_SBAS);
            if (!is_array($sbas_rights)) {
                throw new Exception('sbas rights were not properly retrieved');
            }

            $this->_global_rights = $global_rights;
            $this->_rights_sbas = $sbas_rights;

            return $this;
        } catch (\Exception $e) {
            // no-op
        }

        $sql = "SELECT sbasusr.* FROM sbasusr INNER JOIN sbas USING(sbas_id) WHERE usr_id= :usr_id";

        $stmt = $this->app->getApplicationBox()->get_connection()->prepare($sql);
        $stmt->execute([':usr_id' => $this->user->getId()]);
        $rs = $stmt->fetchAll(PDO::FETCH_ASSOC);
        $stmt->closeCursor();

        $this->_rights_sbas = [];

        foreach(self::$sbas_rights as $b) {
            $this->_global_rights[$b] = false;
        }

        foreach ($rs as $row) {
            $sbid = $row['sbas_id'];
            $this->_rights_sbas[$sbid] = [];
            foreach (self::$sbas_rights as $b) {
                $this->_global_rights[$b] = ($this->_rights_sbas[$sbid][$b] = ($row[$b] == '1')) || $this->_global_rights[$b];
            }
        }
        $this->set_data_to_cache($this->_rights_sbas, self::CACHE_RIGHTS_SBAS);
        $this->set_data_to_cache($this->_global_rights, self::CACHE_GLOBAL_RIGHTS);

        return $this;
    }
protected function load_rights_sbas ( ) { if ( $ this -> _rights_sbas && $ this -> _global_rights ) { return $ this ; } try { $ global_rights = $ this -> get_data_from_cache ( self :: CACHE_GLOBAL_RIGHTS ) ; if ( ! is_array ( $ global_rights ) ) { throw new Exception ( 'global rights were not properly retrieved' ) ; } $ sbas_rights = $ this -> get_data_from_cache ( self :: CACHE_RIGHTS_SBAS ) ; if ( ! is_array ( $ sbas_rights ) ) { throw new Exception ( 'sbas rights were not properly retrieved' ) ; } $ this -> _global_rights = $ global_rights ; $ this -> _rights_sbas = $ sbas_rights ; return $ this ; } catch ( \ Exception $ e ) { // no-op } $ sql = "SELECT sbasusr.* FROM sbasusr INNER JOIN sbas USING(sbas_id) WHERE usr_id= :usr_id" ; $ stmt = $ this -> app -> getApplicationBox ( ) -> get_connection ( ) -> prepare ( $ sql ) ; $ stmt -> execute ( [ ':usr_id' => $ this -> user -> getId ( ) ] ) ; $ rs = $ stmt -> fetchAll ( PDO :: FETCH_ASSOC ) ; $ stmt -> closeCursor ( ) ; $ this -> _rights_sbas = [ ] ; foreach ( self :: $ sbas_rights as $ b ) { $ this -> _global_rights [ $ b ] = false ; } foreach ( $ rs as $ row ) { $ sbid = $ row [ 'sbas_id' ] ; $ this -> _rights_sbas [ $ sbid ] = [ ] ; foreach ( self :: $ sbas_rights as $ b ) { $ this -> _global_rights [ $ b ] = ( $ this -> _rights_sbas [ $ sbid ] [ $ b ] = ( $ row [ $ b ] == '1' ) ) || $ this -> _global_rights [ $ b ] ; } } $ this -> set_data_to_cache ( $ this -> _rights_sbas , self :: CACHE_RIGHTS_SBAS ) ; $ this -> set_data_to_cache ( $ this -> _global_rights , self :: CACHE_GLOBAL_RIGHTS ) ; return $ this ; }
Loads rights of specified user for all sbas

@return ACL
Loads rights of specified user for all sbas