Skip to content

Commit

Permalink
Fix group alias loading when identity memdb is initialized (#5289)
Browse files Browse the repository at this point in the history
  • Loading branch information
uepoch authored and vishalnayak committed Sep 6, 2018
1 parent f931bf0 commit 0b3607a
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions vault/identity_store_util.go
Original file line number Diff line number Diff line change
Expand Up @@ -923,16 +923,10 @@ func (i *IdentityStore) sanitizeAndUpsertGroup(group *identity.Group, memberGrou
// Sanitize the group alias
if group.Alias != nil {
group.Alias.CanonicalID = group.ID

err = i.sanitizeAlias(group.Alias)
if err != nil {
return err
}

err = i.MemDBUpsertAliasInTxn(txn, group.Alias, true)
if err != nil {
return err
}
}

err = i.UpsertGroupInTxn(txn, group, true)
Expand Down Expand Up @@ -1092,6 +1086,12 @@ func (i *IdentityStore) UpsertGroupInTxn(txn *memdb.Txn, group *identity.Group,
// Increment the modify index of the group
group.ModifyIndex++

if group.Alias != nil {
err = i.MemDBUpsertAliasInTxn(txn, group.Alias, true)
if err != nil {
return err
}
}
// Insert or update group in MemDB using the transaction created above
err = i.MemDBUpsertGroupInTxn(txn, group)
if err != nil {
Expand Down

0 comments on commit 0b3607a

Please sign in to comment.