fix: primary domain claim (#1082)

* fix: primary domain scope (overwrite by roles and rogue `:`)

* disable wrong users

* fix test

* show requested org name

* only show domain when selected
This commit is contained in:
Livio Amstutz
2020-12-14 10:54:29 +01:00
committed by GitHub
parent c6fed8ae86
commit b71a444e86
27 changed files with 245 additions and 148 deletions
@@ -85,17 +85,9 @@ func (l *Login) handleExternalUserRegister(w http.ResponseWriter, r *http.Reques
Roles: []string{orgProjectCreatorRole},
}
if authReq.GetScopeOrgPrimaryDomain() != "" {
primaryDomain := authReq.GetScopeOrgPrimaryDomain()
org, err := l.authRepo.GetOrgByPrimaryDomain(primaryDomain)
if err != nil {
l.renderRegisterOption(w, r, authReq, err)
return
}
if org.ID != iam.GlobalOrgID {
member = nil
resourceOwner = org.ID
}
if authReq.RequestedOrgID != "" && authReq.RequestedOrgID != iam.GlobalOrgID {
member = nil
resourceOwner = authReq.RequestedOrgID
}
orgIamPolicy, err := l.getOrgIamPolicy(r, resourceOwner)
if err != nil {