Jump to content

ACL (Access Control List)


bigjoe11a

Recommended Posts

In my project. I wanted an option that was going to give me more control over what my users can and could not do. I fount a ACL Sample and well the guy that made this must have been drunk. Any way I been working with it and putting it together so that it will work. The problem is that when I view the users current permissions it doesn't seem to display then right. Blow is the code i have in a switch that I use to manage each users permissions. The $_GET['uid'] gets the users id from the URL in the admin section.

 

case "manage":
    
    	//$userACL = new ACL($_GET['uid']);
        $userACL = new ACL($_GET['uid']);
    	echo '<h2>Managing '.$userACL->getUsername($_GET['uid']).'</h2>';
        echo '... Some form to edit user info ...';
        echo '<h5>Roles for user:   (<a href="users.php?action=roles&uid='.$_GET['uid'].'">Manage Roles</a>)</h5>';
        echo '<ul>';
        $roles = $userACL->getUserRoles($_GET['uid']);
	foreach ($roles as $k => $v)
	{
		echo "<li>" . $userACL->getRoleNameFromID($v) . "</li>";
	}

        echo '</ul>';
        echo '<h6>Permissions for user:   (<a href="users.php?action=perms&uid='.$_GET['uid'].'">Manage Permissions</a>)</h6>';
        echo '<ul>';
        
        //$uparms = $userACL->getAllPerms($_GET['uid']);
        //$uPerms = $userACL->getUserPerms($_GET['uid']);
        //$aPerms = $userACL->getAllPerms('full');
        $aPerms = $userACL->perms;
	//foreach ($perms as $k => $v)
        foreach($aPerms as $k => $v)
	{		  
	    //echo 'fdfdsfsd :'. $v['value'];
		//if ($v['value'] == false) { continue; }
            if($v['value']) { // if (!$v['value']) { continue; }
		echo "<li>" . $v['Name'] . ' : Allowed </li>';
		//if ($v['inheritted']) { echo "  (inheritted)"; }

            } else {
            echo "<li>" . $v['Name'] . ' : Deny </li>';
            }            
            
           	echo "</li>";
	}		
        echo '</ul>';       
   
break;
    

 

If any one needs any extra info. Please let me know.

 

 

Link to comment
https://forums.phpfreaks.com/topic/256599-acl-access-control-list/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.