Skip to content
This repository has been archived by the owner on Jan 31, 2024. It is now read-only.

Commit

Permalink
Revert "Populate owner data in the ocs and ocdav services (cs3org#2233)"
Browse files Browse the repository at this point in the history
This reverts commit 8dc78c6.
  • Loading branch information
ishank011 committed Jun 8, 2022
1 parent fb3cbed commit 45e1849
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 22 deletions.
3 changes: 0 additions & 3 deletions changelog/1.18.0_2022-02-11/ocs-user-data.md

This file was deleted.

4 changes: 1 addition & 3 deletions internal/http/services/owncloud/ocdav/ocdav.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import (
"strings"
"time"

"github.com/ReneKroon/ttlcache/v2"
"github.com/ReneKroon/ttlcache"
gateway "github.com/cs3org/go-cs3apis/cs3/gateway/v1beta1"
userpb "github.com/cs3org/go-cs3apis/cs3/identity/user/v1beta1"
rpc "github.com/cs3org/go-cs3apis/cs3/rpc/v1beta1"
Expand Down Expand Up @@ -202,8 +202,6 @@ func NewWith(conf *Config, fm favorite.Manager, ls LockSystem, _ *zerolog.Logger
LockSystem: ls,
userIdentifierCache: ttlcache.NewCache(),
}
_ = s.userIdentifierCache.SetTTL(60 * time.Second)

// initialize handlers and set default configs
if err := s.webDavHandler.init(conf.WebdavNamespace, true); err != nil {
return nil, err
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,22 +53,7 @@ func (h *Handler) Init(c *config.Config) {
// GetGroups handles GET requests on /cloud/users/groups
// TODO: implement
func (h *Handler) GetGroups(w http.ResponseWriter, r *http.Request) {
ctx := r.Context()

user := chi.URLParam(r, "userid")
// FIXME use ldap to fetch user info
u, ok := ctxpkg.ContextGetUser(ctx)
if !ok {
response.WriteOCSError(w, r, response.MetaServerError.StatusCode, "missing user in context", fmt.Errorf("missing user in context"))
return
}
if user != u.Username {
// FIXME allow fetching other users info? only for admins
response.WriteOCSError(w, r, http.StatusForbidden, "user id mismatch", fmt.Errorf("%s tried to access %s user info endpoint", u.Id.OpaqueId, user))
return
}

response.WriteOCSSuccess(w, r, &Groups{Groups: u.Groups})
response.WriteOCSSuccess(w, r, &Groups{})
}

// Quota holds quota information
Expand Down

0 comments on commit 45e1849

Please sign in to comment.