Quantcast
Channel: Yii Framework Forum
Viewing all articles
Browse latest Browse all 18717

checkAccess failure

$
0
0
Hi,

I've honestly exhausted a search on a possible explanation for this before posting, so please your help will be appreciated.

I'm trying something as simple as using checkAccess to see if user is admin however I'm not getting any results..I'm stumped. I'm accessing it in a view file, where the objective is to show a specific link for admins (and in the future, I will have respective links of other users/user groups).

My question is why isn't " Yii::app()->user->checkAccess('admin') " working when the user is logged in as admin?

am I lacking the required braincells to figure this out lol please help?
<?php if (Yii::app()->user->checkAccess('admin')) {
    $this->widget('zii.widgets.CMenu', array(
        'items' => $this->menu,
        'htmlOptions' => array('class' => 'operations'),
    ));
} else { echo "<small>Please login</small>";}
    ?>

Viewing all articles
Browse latest Browse all 18717

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>