Refactor decorator and is_granted util function to be more widely used. Add tests for class access