Skip to content

Commit

Permalink
bugfix: Don't return disabled users on GetUser call
Browse files Browse the repository at this point in the history
  • Loading branch information
rhafer committed Dec 20, 2023
1 parent 6e8505c commit 9b7ec1e
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
7 changes: 7 additions & 0 deletions changelog/unreleased/fix-hide-disabled-users.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Bugfix: Don't return disabled users in GetUser call

We fixed a bug where it was still possible to lookup a disabled User if
the user's ID was known.

https://github.com/cs3org/reva/pull/4426
https://github.com/owncloud/ocis/issues/7962
4 changes: 4 additions & 0 deletions pkg/user/manager/ldap/ldap.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,10 @@ func (m *manager) GetUser(ctx context.Context, uid *userpb.UserId, skipFetchingG
return nil, err
}

if m.c.LDAPIdentity.IsLDAPUserInDisabledGroup(log, m.ldapClient, userEntry) {
return nil, errtypes.NotFound("user is locally disabled")
}

if skipFetchingGroups {
return u, nil
}
Expand Down
3 changes: 2 additions & 1 deletion pkg/utils/ldap/identity.go
Original file line number Diff line number Diff line change
Expand Up @@ -503,11 +503,12 @@ func (i *Identity) getUserFilter(uid string) (string, error) {
escapedUUID = ldap.EscapeFilter(uid)
}

return fmt.Sprintf("(&%s(objectclass=%s)(%s=%s))",
return fmt.Sprintf("(&%s(objectclass=%s)(%s=%s)%s)",
i.User.Filter,
i.User.Objectclass,
i.User.Schema.ID,
escapedUUID,
i.disabledFilter(),
), nil
}

Expand Down

0 comments on commit 9b7ec1e

Please sign in to comment.