mirror of
https://github.com/opencloud-eu/opencloud.git
synced 2026-01-04 19:29:49 -06:00
fix: missing invitation in permission responses
Fixes a bug where the `invitation` property is missing in the response when creating, listing or updating graph permissions.
This commit is contained in:
@@ -0,0 +1,6 @@
|
||||
Bugfix: Missing invitation in permission responses
|
||||
|
||||
We have fixed a bug where the `invitation` property was missing in the response when creating, listing or updating graph permissions.
|
||||
|
||||
https://github.com/owncloud/ocis/pull/9652
|
||||
https://github.com/owncloud/ocis/issues/9571
|
||||
@@ -16,6 +16,7 @@ import (
|
||||
ocm "github.com/cs3org/go-cs3apis/cs3/sharing/ocm/v1beta1"
|
||||
storageprovider "github.com/cs3org/go-cs3apis/cs3/storage/provider/v1beta1"
|
||||
types "github.com/cs3org/go-cs3apis/cs3/types/v1beta1"
|
||||
revactx "github.com/cs3org/reva/v2/pkg/ctx"
|
||||
"github.com/cs3org/reva/v2/pkg/publicshare"
|
||||
"github.com/cs3org/reva/v2/pkg/rgrpc/todo/pool"
|
||||
"github.com/cs3org/reva/v2/pkg/share"
|
||||
@@ -224,6 +225,19 @@ func (s DriveItemPermissionsService) Invite(ctx context.Context, resourceId *sto
|
||||
permission.SetExpirationDateTime(utils.TSToTime(expiration))
|
||||
}
|
||||
|
||||
if user, ok := revactx.ContextGetUser(ctx); ok {
|
||||
identity, err := userIdToIdentity(ctx, s.identityCache, user.GetId().GetOpaqueId())
|
||||
if err != nil {
|
||||
s.logger.Error().Err(err).Msg("identity lookup failed")
|
||||
return libregraph.Permission{}, errorcode.New(errorcode.InvalidRequest, err.Error())
|
||||
}
|
||||
permission.SetInvitation(libregraph.SharingInvitation{
|
||||
InvitedBy: &libregraph.IdentitySet{
|
||||
User: &identity,
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
return *permission, nil
|
||||
}
|
||||
|
||||
|
||||
@@ -404,6 +404,19 @@ func (g BaseGraphService) cs3UserShareToPermission(ctx context.Context, share *c
|
||||
perm.SetRoles(nil)
|
||||
}
|
||||
perm.SetGrantedToV2(grantedTo)
|
||||
if share.GetCreator() != nil {
|
||||
identity, err := cs3UserIdToIdentity(ctx, g.identityCache, share.GetCreator())
|
||||
if err != nil {
|
||||
return nil, errorcode.New(errorcode.GeneralException, err.Error())
|
||||
}
|
||||
perm.SetInvitation(
|
||||
libregraph.SharingInvitation{
|
||||
InvitedBy: &libregraph.IdentitySet{
|
||||
User: &identity,
|
||||
},
|
||||
},
|
||||
)
|
||||
}
|
||||
return &perm, nil
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user