Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error Using $this when not in object context #11

Open
Lefthandmedia opened this issue Feb 21, 2014 · 1 comment
Open

error Using $this when not in object context #11

Lefthandmedia opened this issue Feb 21, 2014 · 1 comment
Labels

Comments

@Lefthandmedia
Copy link

Hi,
i'm seeing an error in my server logs 'Using $this when not in object context in'.
this is a line in a cached snippet. Don't know from what snippet but i suspect it is quickbar that's why i'm posting here.

function elements_modsnippet_74($scriptProperties= array()) {
global $modx;
if (is_array($scriptProperties)) {
extract($scriptProperties, EXTR_SKIP);
}
if (!$modx->user->hasSessionContext('mgr') ) return '';

$resource = $modx->resource;
$user = $modx->getUser();
$membership = $user->getUserGroups();

$policies = $resource->findPolicy();

if(count($policies)){
    $checkPolicy = $this->hasAccess($policies,$membership);        
    if(!$checkPolicy){
        return '{"error":"Access is denied"}';
    }
}

$defaultQuickBarCorePath = $modx->getOption('core_path').'components/quickbar/';
$quickbarsCorePath = $modx->getOption('quickbar.core_path',null,$defaultQuickBarCorePath);
$quickbar = $modx->getService('quickbar','QuickBar',$quickbarsCorePath.'model/quickbar/',$scriptProperties);

$modx->regClientCSS($quickbar->parse($modx->getOption('quickbar.css',null,$modx->getOption('assets_url') . 'components/quickbar/retro.css')));
return $quickbar->getChunk('quickbar',array('mgr_url' => MODX_MANAGER_URL));
}

The line in question is

 $checkPolicy = $this->hasAccess($policies,$membership);  

This happens when a user from a specific usergroup tries to view a page that is within a resourcegroup with that this group HAS the right to see.

Anyone else experiences this?

LHM

@jpdevries
Copy link
Owner

Thanks for reporting this. will give a shot at reproducing it

@jpdevries jpdevries added the bug label Feb 22, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants