Welcome Guest, Not a member yet? Register   Sign In
restricting scaffolding
#1

[eluser]misterdonut[/eluser]
i know scaffolding is for a quick database tool for developer but...

is there anyway to restrict the scaffolding feature?

for example it will only be available for some users? or you can only access it if you're logged in?
#2

[eluser]Colin Williams[/eluser]
For sure. You enable scaffolding in the Controller constructor, like this:

Code:
<?php
class Blog extends Controller {

       function Blog()
       {
            parent::Controller();

            $this->load->scaffolding('table_name');
       }
}
?>

So, all you have to do is wrap some access check around $this->load->scaffolding('table_name');

Code:
<?php
class Blog extends Controller {

       function Blog()
       {
            parent::Controller();

            if ($access === TRUE)
            {
                 $this->load->scaffolding('table_name');
            }
            else
            {
                 redirect('user/login');
            }
       }
}
?>
#3

[eluser]misterdonut[/eluser]
can i do it like this
Code:
<?php
class Blog extends Controller {

       function Blog()
       {
            parent::Controller();

            if ($_SESSION['access']=== TRUE) //use session for checking?
            {
                 $this->load->scaffolding('table_name');
            }
            else
            {
                 redirect('user/login');
            }
       }
}
?>
#4

[eluser]Yash[/eluser]
yea that will works




Theme © iAndrew 2016 - Forum software by © MyBB