refactor hasAuthority