Part of the EllisLab Network
   
 
Scaffolding
Posted: 05 July 2007 05:12 PM   [ Ignore ]  
Summer Student
Total Posts:  16
Joined  12-16-2006

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:

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.

Profile
 
 
Posted: 06 July 2007 03:36 AM   [ Ignore ]   [ # 1 ]  
Research Assistant
RankRankRank
Total Posts:  917
Joined  07-10-2006

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_design/fine_grained_role_based_access_control_rbac_system-3/

Profile
 
 
Posted: 06 July 2007 04:35 AM   [ Ignore ]   [ # 2 ]  
Summer Student
Total Posts:  16
Joined  12-16-2006

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

Profile
 
 
Posted: 06 July 2007 01:11 PM   [ Ignore ]   [ # 3 ]  
Lab Assistant
RankRank
Total Posts:  119
Joined  06-22-2007

Hey Xikeon,

I’ve got the trigger on “admin”.

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

http://yourhost/user/admin

In the following statement I suspect one of the two evaluations returns FALSE, 0 or a negative value:

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.

Profile
 
 
Posted: 06 July 2007 04:39 PM   [ Ignore ]   [ # 4 ]  
Summer Student
Total Posts:  16
Joined  12-16-2006
_mike_ - 06 July 2007 01:11 PM

Hey Xikeon,

I’ve got the trigger on “admin”.

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

http://yourhost/user/admin

In the following statement I suspect one of the two evaluations returns FALSE, 0 or a negative value:

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.

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

Profile
 
 
   
 
 
Post Marker Legend
New Topic New posts Hot Topic Hot Topic with new posts New Poll New Poll Moved Topic Moved Topic Sticky Topic Sticky topic
Old Topic No new posts Hot Old Topic Hot Topic with no new posts Old Poll Old Poll Closed Topic Closed Topic Announcement Announcements
Theme
Change Theme
Visitor Statistics
The most visitors ever was 721, on January 06, 2010 09:38 AM
Total Registered Members: 115027 Total Logged-in Users: 64
Total Topics: 122466 Total Anonymous Users: 3
Total Replies: 647381 Total Guests: 461
Total Posts: 769847    
Members ( View Memberlist )