Skip to content

Commit

Permalink
Merge branch 'edge' into improve-posixfs
Browse files Browse the repository at this point in the history
  • Loading branch information
aduffeck authored Jun 26, 2024
2 parents f59602f + 178ea23 commit 4def5a8
Show file tree
Hide file tree
Showing 7 changed files with 51 additions and 7 deletions.
6 changes: 6 additions & 0 deletions changelog/unreleased/add-backchannel-event.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Enhancement: Add the backchannel logout event

We've added the backchannel logout event

https://github.com/cs3org/reva/pull/4737
https://github.com/owncloud/ocis/issues/9355
5 changes: 5 additions & 0 deletions changelog/unreleased/expose-disable-versioning.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Enhancement: Expose disable-versioning configuration option

This PR exposes the disable-versioning configuration option to the user. This option allows the user to disable versioning for the storage-providers.

https://github.com/cs3org/reva/pull/4742
6 changes: 6 additions & 0 deletions changelog/unreleased/serviceuser-token-utils.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Enhancement: Add GetServiceUserToken() method to utils pkg

Added GetServiceUserToken() function to the utils pkg to easily get a reva
token for a service account.

https://github.com/cs3org/reva/pull/4738
14 changes: 14 additions & 0 deletions pkg/events/users.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,3 +88,17 @@ func (PersonalDataExtracted) Unmarshal(v []byte) (interface{}, error) {
err := json.Unmarshal(v, &e)
return e, err
}

// BackchannelLogout is emitted when the callback from the identity provider is received
type BackchannelLogout struct {
Executant *user.UserId
SessionId string
Timestamp *types.Timestamp
}

// Unmarshal to fulfill umarshaller interface
func (BackchannelLogout) Unmarshal(v []byte) (interface{}, error) {
e := BackchannelLogout{}
err := json.Unmarshal(v, &e)
return e, err
}
9 changes: 5 additions & 4 deletions pkg/storage/utils/decomposedfs/decomposedfs.go
Original file line number Diff line number Diff line change
Expand Up @@ -157,10 +157,11 @@ func NewDefault(m map[string]interface{}, bs tree.Blobstore, es events.Stream) (
}

aspects := aspects.Aspects{
Lookup: lu,
Tree: tp,
Permissions: permissions.NewPermissions(node.NewPermissions(lu), permissionsSelector),
EventStream: es,
Lookup: lu,
Tree: tp,
Permissions: permissions.NewPermissions(node.NewPermissions(lu), permissionsSelector),
EventStream: es,
DisableVersioning: o.DisableVersioning,
}

return New(o, aspects)
Expand Down
2 changes: 2 additions & 0 deletions pkg/storage/utils/decomposedfs/options/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,8 @@ type Options struct {
MaxQuota uint64 `mapstructure:"max_quota"`

MountID string `mapstructure:"mount_id"`

DisableVersioning bool `mapstructure:"disable_versioning"`
}

// AsyncPropagatorOptions holds the configuration for the async propagator
Expand Down
16 changes: 13 additions & 3 deletions pkg/utils/grpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,20 +44,30 @@ func GetServiceUserContext(serviceUserID string, gwc gateway.GatewayAPIClient, s

// GetServiceUserContextWithContext returns an authenticated context of the given service user
func GetServiceUserContextWithContext(ctx context.Context, gwc gateway.GatewayAPIClient, serviceUserID string, serviceUserSecret string) (context.Context, error) {
token, err := GetServiceUserToken(ctx, gwc, serviceUserID, serviceUserSecret)
if err != nil {
return nil, err
}

return metadata.AppendToOutgoingContext(ctx, ctxpkg.TokenHeader, token), nil
}

// GetServiceUserToken returns a reva authentication token for the given service user
func GetServiceUserToken(ctx context.Context, gwc gateway.GatewayAPIClient, serviceUserID string, serviceUserSecret string) (string, error) {
authRes, err := gwc.Authenticate(ctx, &gateway.AuthenticateRequest{
Type: "serviceaccounts",
ClientId: serviceUserID,
ClientSecret: serviceUserSecret,
})
if err != nil {
return nil, err
return "", err
}

if err := checkStatusCode("authenticating service user", authRes.GetStatus().GetMessage(), authRes.GetStatus().GetCode()); err != nil {
return nil, err
return "", err
}

return metadata.AppendToOutgoingContext(ctx, ctxpkg.TokenHeader, authRes.Token), nil
return authRes.Token, nil
}

// GetUser gets the specified user
Expand Down

0 comments on commit 4def5a8

Please sign in to comment.