src/snac/server/database/DBUser.php
/**
     * Does user have a privilege
     *
     * Returns true if the privilege exists. Build a list of all the privs, then test the list for key
     * existence.  A User has a set of Privileges beased on their Roles
     *
     * @param \snac\data\User $user User object for which to check privileges
     * @param \snac\data\Privilege $privilege Privilege to test against the user
     *
     * @return boolean True if the $user has $privilege in any of the roles, return false otherwise.
     */
Does user have a privilege
Returns true if the privilege exists. Build a list of all the privs, then test the list for key
existence.  A User has a set of Privileges beased on their Roles



@return boolean True if the $user has $privilege in any of the roles, return false otherwise.
Does user have a privilege Returns true if the privilege exists . Build a list of all the privs then test the list for key existence . A User has a set of Privileges beased on their Roles @return boolean True if the $user has $privilege in any of the roles return false otherwise .
public function hasPrivilege($user, $privilege)
    {
        $allPrivs = array(); 
        foreach($user->getRoleList() as $userRole)
        {
            foreach($userRole->getPrivilegeList() as $priv)
            {
                $allPrivs[$priv->getID()] = 1;
            }
        }
        return isset($allPrivs[$privilege->getID()]);
    }
public function hasPrivilege ( $ user , $ privilege ) { $ allPrivs = array ( ) ; foreach ( $ user -> getRoleList ( ) as $ userRole ) { foreach ( $ userRole -> getPrivilegeList ( ) as $ priv ) { $ allPrivs [ $ priv -> getID ( ) ] = 1 ; } } return isset ( $ allPrivs [ $ privilege -> getID ( ) ] ) ; }
Does user have a privilege
 Returns true if the privilege exists.
Does user have a privilege Returns true if the privilege exists .
// assoc list