Yii Framework Forum: How To Only Load Extension For Admin User? - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

How To Only Load Extension For Admin User? Rate Topic: -----

#1 User is offline   rbot 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 8
  • Joined: 30-November 12

Posted 11 December 2012 - 12:16 PM

I am using the extension ext.yii-debug-toolbar.YiiDebugToolbarRoute and currently loading it in the components section of main config with this:

'log' => array(
	'class' => 'CLogRouter',
	'routes' => array(
		array(
		    'class' => 'ext.yii-debug-toolbar.YiiDebugToolbarRoute',
		    'ipFilters' => array('127.0.0.1','::1')
		)
    )
)


Instead of using ipFilters, I'd ideally like to use an expression like the following to limit access to the admin user (note that I use this same expression in my admin controllers):

'expression' => '$user->isAdmin()'


The admin user can log in from various IP addresses and I can't keep these IPs hard-coded in the code. Is it possible to use an expression to filter instead of IP? If not, is it possible to remove the extension autoloading from the config and dynamically load it elsewhere if the user is admin?
0

#2 User is offline   alirz23 

  • Master Member
  • PipPipPipPip
  • Yii
  • Group: Members
  • Posts: 1,086
  • Joined: 08-August 12
  • Location:Durban, South Africa

Posted 11 December 2012 - 01:10 PM

you might need to modify the ext itself.
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users