An Idea for Managing Security Quickly

Just an idea for implementing it quickly.

You can take existing code and bolt this code on, and then use it to produce somewhat readable code with rudimentary security features.

// $GROUPS = array( 'Guest', 'Unconfirmed', 'Approval', 'Active', 'Rejected', 'Admin', 'Moderator' ); 

$ACCESS = array(
	'view_friends' => array( 'group', 'group2', 'group3' ),
	'view_comments' => array( 'group', 'group2', 'group3' ),
	'suspend_user' => array( 'group', 'group2', 'group3' ),
	'use_chatroom' => array( 'group', 'group2', 'group3' ),
	'send_message_as_mail' => array( 'group', 'group2', 'group3' ),
	'ability' => array( 'group', 'group2', 'group3' )
);

function cando( $user, $ability )
{
	// get the user's groups
	// check permissions for an ability
	// return true if their groups are in the ability's array
}