Jump to content

Highlander

Members
  • Posts

    39
  • Joined

  • Last visited

    Never

Posts posted by Highlander

  1. The only problem as far as I know is the fact that you need to know if the data is valid.

     

    So, if the data in the database is updated, the session instance doesn't know about it.

    Other then that, it should be ok.

  2. That will work for simple auth, but the problem is that I must check if a member is member of a given group.

     

    One solution I have thought of was:

    <?php
    if( $logged_in_member->checkIfMemberOfGroup ("Admin") ) {
        echo "<a href='/delete/id'>delete</a>";
    }
    ?>

     

    The problem with this solution is that I need to store a member object on each page.

     

    Any suggestions?

  3. Hello guys!

     

    This is my first post so bare with me here :)

     

    I'm reading on OOP and MVC pattern and I need some opinions about this code:

     

    <?php 
    class MemberView {
    
    # Reference to a model
    private $model;
    
    # Creates a new view from a model
    public function __construct( $memberModel ) {
    	$this->model = $memberModel;
    }
    
    /* displays the list of members */
    public function display( ) {
    
    	$members = $this->model->getMembers( );
    	foreach ($members as $member) {
    		$name = $member->getName( );
    		echo "
    			<p>Name: $name</p>
    		";
    	}
    }
    }
    
    ?>
    

     

    This code just prints out all members. But now to the question:

     

    How do I add access control to this view? I mean if a member that is logged in and views this given page has access to delete a member, then MemberView needs to add a link to a delete action. But how is the best way to do this?

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.