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

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 04:36 AM   [ Ignore ]   [ # 1 ]  
Research Assistant
RankRankRank
Total Posts:  888
Joined  2006-07-10

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 05:35 AM   [ Ignore ]   [ # 2 ]  
Summer Student
Total Posts:  16
Joined  2006-12-16

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 02:11 PM   [ Ignore ]   [ # 3 ]  
Lab Assistant
RankRank
Total Posts:  115
Joined  2007-06-22

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 05:39 PM   [ Ignore ]   [ # 4 ]  
Summer Student
Total Posts:  16
Joined  2006-12-16
_mike_ - 06 July 2007 02: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 719, on June 06, 2008 10:16 AM
Total Registered Members: 58779 Total Logged-in Users: 13
Total Topics: 69461 Total Anonymous Users: 0
Total Replies: 373909 Total Guests: 241
Total Posts: 443370    
Members ( View Memberlist )