Implement a better way to do check permission