Refactor resource permission checker