Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

when sharing via ocs look up user by username #1281

Merged
merged 2 commits into from
Nov 23, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions changelog/unreleased/ocs-lookup-user-by-username.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Bugfix: when sharing via ocs look up user by username

The ocs api returns usernames when listing share recipients, so the lookup when creating the share needs to search the usernames and not the userid.

https://github.com/cs3org/reva/pull/1281
Original file line number Diff line number Diff line change
Expand Up @@ -195,8 +195,9 @@ func (h *Handler) createUserShare(w http.ResponseWriter, r *http.Request) {
return
}

userRes, err := c.GetUser(ctx, &userpb.GetUserRequest{
UserId: &userpb.UserId{OpaqueId: shareWith},
userRes, err := c.GetUserByClaim(ctx, &userpb.GetUserByClaimRequest{
Claim: "username",
Value: shareWith,
})
if err != nil {
response.WriteOCSError(w, r, response.MetaServerError.StatusCode, "error searching recipient", err)
Expand Down Expand Up @@ -271,7 +272,7 @@ func (h *Handler) createUserShare(w http.ResponseWriter, r *http.Request) {
createShareReq := &collaboration.CreateShareRequest{
Opaque: &types.Opaque{
Map: map[string]*types.OpaqueEntry{
"role": &types.OpaqueEntry{
"role": {
Decoder: "json",
Value: val,
},
Expand Down
9 changes: 5 additions & 4 deletions tests/oc-integration-tests/drone/ldap-users.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@ auth_manager = "ldap"
hostname="ldap"
port=636
base_dn="dc=owncloud,dc=com"
userfilter="(&(objectclass=posixAccount)(cn=%s*))"
groupfilter="(&(objectclass=posixGroup)(cn=%s*))"
loginfilter="(&(objectclass=posixAccount)(|(cn={{login}}))(uid={{login}}))"
bind_username="cn=admin,dc=owncloud,dc=com"
bind_password="admin"
idp="http://localhost:18000"
Expand All @@ -32,8 +31,10 @@ driver = "ldap"
hostname="ldap"
port=636
base_dn="dc=owncloud,dc=com"
userfilter="(&(objectclass=posixAccount)(cn=%s*))"
groupfilter="(&(objectclass=posixGroup)(cn=%s*))"
userfilter="(&(objectclass=posixAccount)(|(uid={{.OpaqueId}})(cn={{.OpaqueId}})))"
findfilter="(&(objectclass=posixAccount)(|(cn={{query}}*)(displayname={{query}}*)(mail={{query}}*)))"
attributefilter="(&(objectclass=posixAccount)({{attr}}={{value}}))"
groupfilter="(&(objectclass=posixGroup)(cn={{.OpaqueId}}))"
bind_username="cn=admin,dc=owncloud,dc=com"
bind_password="admin"
idp="http://localhost:18000"
Expand Down
9 changes: 5 additions & 4 deletions tests/oc-integration-tests/local/ldap-users.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@ auth_manager = "ldap"
hostname="localhost"
port=636
base_dn="dc=owncloud,dc=com"
userfilter="(&(objectclass=posixAccount)(cn=%s*))"
groupfilter="(&(objectclass=posixGroup)(cn=%s*))"
loginfilter="(&(objectclass=posixAccount)(|(cn={{login}}))(uid={{login}}))"
bind_username="cn=admin,dc=owncloud,dc=com"
bind_password="admin"
idp="http://localhost:18000"
Expand All @@ -32,8 +31,10 @@ driver = "ldap"
hostname="localhost"
port=636
base_dn="dc=owncloud,dc=com"
userfilter="(&(objectclass=posixAccount)(cn=%s*))"
groupfilter="(&(objectclass=posixGroup)(cn=%s*))"
userfilter="(&(objectclass=posixAccount)(|(uid={{.OpaqueId}})(cn={{.OpaqueId}})))"
findfilter="(&(objectclass=posixAccount)(|(cn={{query}}*)(displayname={{query}}*)(mail={{query}}*)))"
attributefilter="(&(objectclass=posixAccount)({{attr}}={{value}}))"
groupfilter="(&(objectclass=posixGroup)(cn={{.OpaqueId}}))"
bind_username="cn=admin,dc=owncloud,dc=com"
bind_password="admin"
idp="http://localhost:18000"
Expand Down