Added permissions check function
Added basic security for login checking