Improve UpstreamReference (#1004)* Switch to equals instead of == in getPosition* Rewrite UpstreamReference* Improve permission override and upstream reference implementation* Only keep id for permission overrides (commit: 4426e2e)