CodeIgniter Forums

Full Version: Scaffolding
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum

[eluser]Xikeon[/eluser]
Hello,

I know that Scaffolding is only for developers but isn't there a way to protect it?
I've got the trigger on "admin".

Now, this is how I try to protect it:
Code:
function User( )
    {
        parent::Controller( );
        
        if( $this->userlib->logged_in( ) && $this->userlib->getData( $this->session->userdata( 'username' ), 'status' ) == 3 )
        {
            $this->load->scaffolding( 'users' );
        }
    }
That's my userlib login and status check for admin.

But now it never opens scaffolding. Is there a way to make it only viewable for status 3 members? Or anything else?

Thanks,
Mike.

El Forum

[eluser]esra[/eluser]
If your status column was a foreign id to another table called roles, you could use yet another table to associate permissions with roles. Then you need to develop methods to conditionally grant or invoke permissions.

For some ideas, look here:

http://www.sqlrecipes.com/database_desig..._system-3/

El Forum

[eluser]Xikeon[/eluser]
How would that help me? I prefer my way now, and I just want status 3 people to see the Scaffolding..

El Forum

[eluser]Michael Ekoka[/eluser]
Hey Xikeon,

Quote:I’ve got the trigger on “admin”.

I assume this is how you're calling your scaffold:

Quote:http://yourhost/user/admin

In the following statement I suspect one of the two evaluations returns FALSE, 0 or a negative value:
Code:
if( $this->userlib->logged_in( ) && $this->userlib->getData( $this->session->userdata( 'username' ), 'status' ) == 3 )

Try to output their value on screen and see if they are consistent with what you expected.

El Forum

[eluser]Xikeon[/eluser]
[quote author="_mike_" date="1183767099"]Hey Xikeon,

Quote:I’ve got the trigger on “admin”.

I assume this is how you're calling your scaffold:

Quote:http://yourhost/user/admin

In the following statement I suspect one of the two evaluations returns FALSE, 0 or a negative value:
Code:
if( $this->userlib->logged_in( ) && $this->userlib->getData( $this->session->userdata( 'username' ), 'status' ) == 3 )

Try to output their value on screen and see if they are consistent with what you expected.[/quote]

Thanks,
I have tested it and for some reason the second check doesn't work right, which I used before.

I'll see whats wrong with it then, thansk again Smile