Moved the access control into the database backend (db.py) and queue.php queries for access before submitting 'next' to the backend.