New function for checking permissions (for function based view)