Skip to content

Commit 2bdd98f

Browse files
[full-ci] revaBump-v2.40.1 (#1927)
* revaBump-v2.40.0 * adapt tests * bring-#442 * adapt tests * bring-#444 * ocm fixes Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de> * adapt tests * adapt unit tests Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de> * revaUpdate-2.40.1 * update opencloud-version-4.0.0-rc.3 --------- Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de> Co-authored-by: Jörn Friedrich Dreyer <jfd@butonic.de>
1 parent 043a5cf commit 2bdd98f

37 files changed

Lines changed: 889 additions & 373 deletions

File tree

go.mod

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ require (
6464
github.com/open-policy-agent/opa v1.10.1
6565
github.com/opencloud-eu/icap-client v0.0.0-20250930132611-28a2afe62d89
6666
github.com/opencloud-eu/libre-graph-api-go v1.0.8-0.20250724122329-41ba6b191e76
67-
github.com/opencloud-eu/reva/v2 v2.39.3
67+
github.com/opencloud-eu/reva/v2 v2.40.1
6868
github.com/opensearch-project/opensearch-go/v4 v4.5.0
6969
github.com/orcaman/concurrent-map v1.0.0
7070
github.com/pkg/errors v0.9.1
@@ -372,9 +372,9 @@ require (
372372
github.com/xrash/smetrics v0.0.0-20240521201337-686a1a2994c1 // indirect
373373
github.com/yashtewari/glob-intersection v0.2.0 // indirect
374374
github.com/yusufpapurcu/wmi v1.2.4 // indirect
375-
go.etcd.io/etcd/api/v3 v3.6.5 // indirect
376-
go.etcd.io/etcd/client/pkg/v3 v3.6.5 // indirect
377-
go.etcd.io/etcd/client/v3 v3.6.5 // indirect
375+
go.etcd.io/etcd/api/v3 v3.6.6 // indirect
376+
go.etcd.io/etcd/client/pkg/v3 v3.6.6 // indirect
377+
go.etcd.io/etcd/client/v3 v3.6.6 // indirect
378378
go.opencensus.io v0.24.0 // indirect
379379
go.opentelemetry.io/auto/sdk v1.2.1 // indirect
380380
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.38.0 // indirect

go.sum

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -963,8 +963,8 @@ github.com/opencloud-eu/inotifywaitgo v0.0.0-20251111171128-a390bae3c5e9 h1:dIft
963963
github.com/opencloud-eu/inotifywaitgo v0.0.0-20251111171128-a390bae3c5e9/go.mod h1:JWyDC6H+5oZRdUJUgKuaye+8Ph5hEs6HVzVoPKzWSGI=
964964
github.com/opencloud-eu/libre-graph-api-go v1.0.8-0.20250724122329-41ba6b191e76 h1:vD/EdfDUrv4omSFjrinT8Mvf+8D7f9g4vgQ2oiDrVUI=
965965
github.com/opencloud-eu/libre-graph-api-go v1.0.8-0.20250724122329-41ba6b191e76/go.mod h1:pzatilMEHZFT3qV7C/X3MqOa3NlRQuYhlRhZTL+hN6Q=
966-
github.com/opencloud-eu/reva/v2 v2.39.3 h1:/9NW08Bpy1GaNAPo8HrlyT21Flj8uNnOUyWLud1ehGc=
967-
github.com/opencloud-eu/reva/v2 v2.39.3/go.mod h1:kkGiMeEVR59VjDsmWIczWqRcwK8cy9ogTd/u802U3NI=
966+
github.com/opencloud-eu/reva/v2 v2.40.1 h1:QwMkbGMhwDSwfk2WxbnTpIig2BugPBaVFjWcy2DSU3U=
967+
github.com/opencloud-eu/reva/v2 v2.40.1/go.mod h1:DGH08n2mvtsQLkt8o15FV6m51FwSJJGhjR8Ty+iIJww=
968968
github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U=
969969
github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM=
970970
github.com/opencontainers/image-spec v1.1.1 h1:y0fUlFfIZhPF1W537XOLg0/fcx6zcHCJwooC2xJA040=
@@ -1275,12 +1275,12 @@ github.com/yusufpapurcu/wmi v1.2.4/go.mod h1:SBZ9tNy3G9/m5Oi98Zks0QjeHVDvuK0qfxQ
12751275
go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU=
12761276
go.etcd.io/bbolt v1.4.3 h1:dEadXpI6G79deX5prL3QRNP6JB8UxVkqo4UPnHaNXJo=
12771277
go.etcd.io/bbolt v1.4.3/go.mod h1:tKQlpPaYCVFctUIgFKFnAlvbmB3tpy1vkTnDWohtc0E=
1278-
go.etcd.io/etcd/api/v3 v3.6.5 h1:pMMc42276sgR1j1raO/Qv3QI9Af/AuyQUW6CBAWuntA=
1279-
go.etcd.io/etcd/api/v3 v3.6.5/go.mod h1:ob0/oWA/UQQlT1BmaEkWQzI0sJ1M0Et0mMpaABxguOQ=
1280-
go.etcd.io/etcd/client/pkg/v3 v3.6.5 h1:Duz9fAzIZFhYWgRjp/FgNq2gO1jId9Yae/rLn3RrBP8=
1281-
go.etcd.io/etcd/client/pkg/v3 v3.6.5/go.mod h1:8Wx3eGRPiy0qOFMZT/hfvdos+DjEaPxdIDiCDUv/FQk=
1282-
go.etcd.io/etcd/client/v3 v3.6.5 h1:yRwZNFBx/35VKHTcLDeO7XVLbCBFbPi+XV4OC3QJf2U=
1283-
go.etcd.io/etcd/client/v3 v3.6.5/go.mod h1:ZqwG/7TAFZ0BJ0jXRPoJjKQJtbFo/9NIY8uoFFKcCyo=
1278+
go.etcd.io/etcd/api/v3 v3.6.6 h1:mcaMp3+7JawWv69p6QShYWS8cIWUOl32bFLb6qf8pOQ=
1279+
go.etcd.io/etcd/api/v3 v3.6.6/go.mod h1:f/om26iXl2wSkcTA1zGQv8reJRSLVdoEBsi4JdfMrx4=
1280+
go.etcd.io/etcd/client/pkg/v3 v3.6.6 h1:uoqgzSOv2H9KlIF5O1Lsd8sW+eMLuV6wzE3q5GJGQNs=
1281+
go.etcd.io/etcd/client/pkg/v3 v3.6.6/go.mod h1:YngfUVmvsvOJ2rRgStIyHsKtOt9SZI2aBJrZiWJhCbI=
1282+
go.etcd.io/etcd/client/v3 v3.6.6 h1:G5z1wMf5B9SNexoxOHUGBaULurOZPIgGPsW6CN492ec=
1283+
go.etcd.io/etcd/client/v3 v3.6.6/go.mod h1:36Qv6baQ07znPR3+n7t+Rk5VHEzVYPvFfGmfF4wBHV8=
12841284
go.opencensus.io v0.20.1/go.mod h1:6WKK9ahsWS3RSO+PY9ZHZUfv2irvY6gN279GOPZjmmk=
12851285
go.opencensus.io v0.20.2/go.mod h1:6WKK9ahsWS3RSO+PY9ZHZUfv2irvY6gN279GOPZjmmk=
12861286
go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU=

pkg/version/version.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ var (
1616
// LatestTag is the latest released version plus the dev meta version.
1717
// Will be overwritten by the release pipeline
1818
// Needs a manual change for every tagged release
19-
LatestTag = "4.0.0-rc.2+dev"
19+
LatestTag = "4.0.0-rc.3+dev"
2020

2121
// Date indicates the build date.
2222
// This has been removed, it looks like you can only replace static strings with recent go versions

services/graph/pkg/identity/backend.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,10 @@ func CreateUserModelFromCS3(u *cs3user.User) *libregraph.User {
133133
OnPremisesSamAccountName: u.GetUsername(),
134134
Id: &u.GetId().OpaqueId,
135135
}
136+
if u.GetId().GetType() == cs3user.UserType_USER_TYPE_FEDERATED {
137+
ocmUserId := u.GetId().GetOpaqueId() + "@" + u.GetId().GetIdp()
138+
user.Id = &ocmUserId
139+
}
136140
return user
137141
}
138142

services/graph/pkg/identity/cache/cache.go

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ package cache
22

33
import (
44
"context"
5+
"errors"
6+
"strings"
57
"time"
68

79
gateway "github.com/cs3org/go-cs3apis/cs3/gateway/v1beta1"
@@ -133,15 +135,35 @@ func (cache IdentityCache) GetAcceptedUser(ctx context.Context, userid string) (
133135
return *identity.CreateUserModelFromCS3(u), nil
134136
}
135137

138+
func getIDAndMeshProvider(user string) (id, provider string, err error) {
139+
last := strings.LastIndex(user, "@")
140+
if last == -1 {
141+
return "", "", errors.New("not in the form <id>@<provider>")
142+
}
143+
if len(user[:last]) == 0 {
144+
return "", "", errors.New("empty id")
145+
}
146+
if len(user[last+1:]) == 0 {
147+
return "", "", errors.New("empty provider")
148+
}
149+
return user[:last], user[last+1:], nil
150+
}
151+
136152
func (cache IdentityCache) GetAcceptedCS3User(ctx context.Context, userid string) (*cs3User.User, error) {
137153
var user *cs3user.User
138154
if item := cache.users.Get(userid); item == nil {
139155
gatewayClient, err := cache.gatewaySelector.Next()
140156
if err != nil {
141157
return nil, errorcode.New(errorcode.GeneralException, err.Error())
142158
}
159+
id, provider, err := getIDAndMeshProvider(userid)
160+
if err != nil {
161+
return nil, errorcode.New(errorcode.InvalidRequest, err.Error())
162+
}
143163
cs3UserID := &cs3User.UserId{
144-
OpaqueId: userid,
164+
Idp: provider,
165+
OpaqueId: id,
166+
Type: cs3User.UserType_USER_TYPE_FEDERATED,
145167
}
146168
user, err = revautils.GetAcceptedUserWithContext(ctx, cs3UserID, gatewayClient)
147169
if err != nil {

services/graph/pkg/service/v0/users_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1354,6 +1354,7 @@ var _ = Describe("Users", func() {
13541354
Username: "federated",
13551355
Id: &userv1beta1.UserId{
13561356
OpaqueId: "federated",
1357+
Idp: "provider",
13571358
Type: userv1beta1.UserType_USER_TYPE_FEDERATED,
13581359
},
13591360
},
@@ -1377,7 +1378,7 @@ var _ = Describe("Users", func() {
13771378
Expect(err).ToNot(HaveOccurred())
13781379

13791380
Expect(len(res.Value)).To(Equal(1))
1380-
Expect(res.Value[0].GetId()).To(Equal("federated"))
1381+
Expect(res.Value[0].GetId()).To(Equal("federated@provider"))
13811382
Expect(res.Value[0].GetUserType()).To(Equal("Federated"))
13821383
})
13831384
It("does not list federated users when filtering for 'Member' users", func() {

services/graph/pkg/service/v0/utils.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import (
44
"context"
55
"encoding/base64"
66
"encoding/json"
7+
"fmt"
78
"io"
89
"net/http"
910
"reflect"
@@ -106,7 +107,8 @@ func userIdToIdentity(ctx context.Context, cache cache.IdentityCache, tennantId,
106107

107108
// federatedIdToIdentity looks the user for the supplied id using the cache and returns it
108109
// as a libregraph.Identity
109-
func federatedIdToIdentity(ctx context.Context, cache cache.IdentityCache, userID string) (libregraph.Identity, error) {
110+
func federatedIdToIdentity(ctx context.Context, cache cache.IdentityCache, cs3UserID *cs3User.UserId) (libregraph.Identity, error) {
111+
userID := fmt.Sprintf("%s@%s", cs3UserID.GetOpaqueId(), cs3UserID.GetIdp())
110112
identity := libregraph.Identity{
111113
Id: libregraph.PtrString(userID),
112114
LibreGraphUserType: libregraph.PtrString("Federated"),
@@ -123,7 +125,7 @@ func federatedIdToIdentity(ctx context.Context, cache cache.IdentityCache, userI
123125
// as a libregraph.Identity. Skips the user lookup if the id type is USER_TYPE_SPACE_OWNER
124126
func cs3UserIdToIdentity(ctx context.Context, cache cache.IdentityCache, cs3UserID *cs3User.UserId) (libregraph.Identity, error) {
125127
if cs3UserID.GetType() == cs3User.UserType_USER_TYPE_FEDERATED {
126-
return federatedIdToIdentity(ctx, cache, cs3UserID.GetOpaqueId())
128+
return federatedIdToIdentity(ctx, cache, cs3UserID)
127129
}
128130
if cs3UserID.GetType() != cs3User.UserType_USER_TYPE_SPACE_OWNER {
129131
return userIdToIdentity(ctx, cache, cs3UserID.GetTenantId(), cs3UserID.GetOpaqueId())

tests/acceptance/TestHelpers/GraphHelper.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -120,13 +120,12 @@ public static function getEtagRegex(): string {
120120
}
121121

122122
/**
123-
* Federated users have a base64 encoded string of {remoteid}@{provider} as their id
124-
* This regex matches only non empty base64 encoded strings
123+
* Federated users have a string of {userid}@{provider} as their id
125124
*
126125
* @return string
127126
*/
128127
public static function getFederatedUserRegex(): string {
129-
return '(?=(.{4})*$)[A-Za-z0-9+/]*={0,2}$';
128+
return '^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}@https?://.+$';
130129
}
131130

132131
/**

tests/acceptance/bootstrap/FeatureContext.php

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2440,14 +2440,6 @@ public function substituteInLineCodes(
24402440
],
24412441
"parameter" => []
24422442
],
2443-
[
2444-
"code" => "%identities_issuer_id_pattern%",
2445-
"function" => [
2446-
__NAMESPACE__ . '\TestHelpers\GraphHelper',
2447-
"getFederatedUserRegex"
2448-
],
2449-
"parameter" => []
2450-
],
24512443
[
24522444
"code" => "%uuidv4_pattern%",
24532445
"function" => [

tests/acceptance/bootstrap/SharingNgContext.php

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -327,12 +327,11 @@ public function sendShareInvitation(
327327
if ($shareType === "user") {
328328
$shareeId = $this->featureContext->getAttributeOfCreatedUser($sharee, 'id');
329329
if ($federatedShare) {
330-
$shareeId = (
331-
$this->featureContext->ocmContext->getAcceptedUserByName(
332-
$user,
333-
$sharee
334-
)
335-
)['user_id'];
330+
$federatedUser = $this->featureContext->ocmContext->getAcceptedUserByName(
331+
$user,
332+
$sharee
333+
);
334+
$shareeId = $federatedUser['user_id'] . "@" . $federatedUser['idp'];
336335
}
337336
} elseif ($shareType === "group") {
338337
$shareeId = $this->featureContext->getAttributeOfCreatedGroup($sharee, 'id');
@@ -403,7 +402,11 @@ public function sendDriveShareInvitation(
403402
if ($shareType === "user") {
404403
$shareeId = $this->featureContext->getAttributeOfCreatedUser($sharee, 'id');
405404
if ($federatedShare) {
406-
$shareeId = ($this->featureContext->ocmContext->getAcceptedUserByName($user, $sharee))['user_id'];
405+
$federatedUser = $this->featureContext->ocmContext->getAcceptedUserByName(
406+
$user,
407+
$sharee
408+
);
409+
$shareeId = $federatedUser['user_id'] . "@" . $federatedUser['idp'];
407410
}
408411
} elseif ($shareType === "group") {
409412
$shareeId = $this->featureContext->getAttributeOfCreatedGroup($sharee, 'id');

0 commit comments

Comments
 (0)