It is really bad that CodeIgniter does not support password protection in scaffolding. I just go thorugh most scaffolding related posts in CodeIgniter forum, it seems no easy and clear solution for it. So, I just come out my own based on hooks function.
Here comes the code. Just follow it, and you will get a simple password protection for scaffolding:
1. Enable hook in your CodeIgniter application
application/config.php
[...]
$config['enable_hooks'] = TRUE;
[...]
2. Add a hook setting for pre-controller
(閱讀全文)application/hooks.php
[...]
$hook['pre_controller'][] = array(
'class' => 'SimpleHttpAuth',
'function' => 'authenticate',
'filename' => 'SimpleHttpAuth.php',
'filepath' => 'hooks/SimpleHttpAuth',
'params' => array()
);
[...]