Simplified some functions in permissions.py