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

Set correct share type when listing shares #3759

Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Enhancement: Set correct share type when listing shares

This fixes so that we can differentiate between guest/member users for shares.

https://github.com/cs3org/reva/pull/3759
6 changes: 5 additions & 1 deletion internal/http/services/owncloud/ocs/conversions/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ const (
// ShareTypeUser refers to user shares
ShareTypeUser ShareType = 0

// ShareTypeGuestUser refers to guest user shares
ShareTypeGuestUser ShareType = 4

// ShareTypePublicLink refers to public link shares
ShareTypePublicLink ShareType = 3

Expand Down Expand Up @@ -229,7 +232,8 @@ func CS3Share2ShareData(ctx context.Context, share *collaboration.Share) (*Share
if share.Grantee.Type == provider.GranteeType_GRANTEE_TYPE_USER {
sd.ShareType = ShareTypeUser
sd.ShareWith = LocalUserIDToString(share.Grantee.GetUserId())
if share.GetGrantee().GetUserId().GetType() == userpb.UserType_USER_TYPE_LIGHTWEIGHT {
shareType := share.GetGrantee().GetUserId().GetType()
if shareType == userpb.UserType_USER_TYPE_LIGHTWEIGHT || shareType == userpb.UserType_USER_TYPE_GUEST {
sd.ShareWithUserType = ShareWithUserTypeGuest
} else {
sd.ShareWithUserType = ShareWithUserTypeUser
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,10 +100,15 @@ func (h *Handler) FindSharees(w http.ResponseWriter, r *http.Request) {
}

func (h *Handler) userAsMatch(u *userpb.User) *conversions.MatchData {
shareType := conversions.ShareTypeUser
if u.Id.Type == userpb.UserType_USER_TYPE_GUEST {
shareType = conversions.ShareTypeGuestUser
}

return &conversions.MatchData{
Label: u.DisplayName,
Value: &conversions.MatchValueData{
ShareType: int(conversions.ShareTypeUser),
ShareType: int(shareType),
// api compatibility with oc10: always use the username
ShareWith: u.Username,
ShareWithAdditionalInfo: h.getAdditionalInfoAttribute(u),
Expand Down