Skip to content

Commit

Permalink
ldap: Allow groups to have no gidNumber
Browse files Browse the repository at this point in the history
Similar to the user-provider allow a group to have no gidNumber. Assign
a default in that case.
  • Loading branch information
rhafer committed Mar 24, 2022
1 parent 82800d7 commit 3792d54
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
6 changes: 6 additions & 0 deletions changelog/unreleased/group-without-gidnumber.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Change: Allow LDAP groups to have no gidNumber

Similar to the user-provider allow a group to have no gidNumber. Assign
a default in that case.

https://github.com/cs3org/reva/pull/xxxx
11 changes: 8 additions & 3 deletions pkg/group/manager/ldap/ldap.go
Original file line number Diff line number Diff line change
Expand Up @@ -239,9 +239,14 @@ func (m *manager) GetGroupByClaim(ctx context.Context, claim, value string) (*gr
if err != nil {
return nil, err
}
gidNumber, err := strconv.ParseInt(sr.Entries[0].GetEqualFoldAttributeValue(m.c.Schema.GIDNumber), 10, 64)
if err != nil {
return nil, err

gidNumber := m.c.Nobody
gidValue := sr.Entries[0].GetEqualFoldAttributeValue(m.c.Schema.GIDNumber)
if gidValue != "" {
gidNumber, err = strconv.ParseInt(gidValue, 10, 64)
if err != nil {
return nil, err
}
}

g := &grouppb.Group{
Expand Down

0 comments on commit 3792d54

Please sign in to comment.