How to show or hide a content for users

Hi guys!

I have this item in my site/index.php:

<?= Html::a( Yii::t('app', 'Utenti'), ['utenti/index'] ) ?>

I need to show the page only for the user with role 0 (not for 1 and 2).
What I have to do??
Thanks a lot for helping me!!!


well, to show it dependant on roles, there is
But you may want to restrict access at the location of that link to.

1 Like

I do this in my layout file for my Menus by doing something along the lines of

	echo Html::a( Yii::t('app', 'Utenti'), ['utenti/index'] ) ;

Now it’s ok. Thank you very much!