Fix codestyle and whitespace errors for perms
Make failed permission checks throw errors