Add support for revoking user permissions

Also fixes a few minor bugs, as well as add a global error management
class for functions. Allows functions to simply return true/false and
then you can later access the error that was thrown.