mirror of
https://github.com/opencloud-eu/opencloud.git
synced 2026-11-26 10:07:34 -05:00
fix(graph): upd guest share type for driveitems
This commit is contained in:
1 parent
b93909a5c7
commit
1bf81a7ff1
5 files changed
+11
-11
No files matched your search
@@ -619,8 +619,8 @@ func shareTypesOf(info *storageprovider.ResourceInfo, linkShares map[string]stru
|
||||
types = append(types, "user")
|
||||
case strconv.Itoa(int(storageprovider.GranteeType_GRANTEE_TYPE_GROUP)):
|
||||
types = append(types, "group")
|
||||
case strconv.Itoa(int(conversions.ShareTypeGuest)):
|
||||
types = append(types, "guest")
|
||||
case strconv.Itoa(int(conversions.ShareTypeEmail)):
|
||||
types = append(types, "email")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -592,7 +592,7 @@ var _ = Describe("Driveitems", func() {
|
||||
Expect(res.Value[0].LibreGraphShareTypes).To(ConsistOf("user", "group", "link"))
|
||||
})
|
||||
|
||||
It("reports a guest share as a guest share type", func() {
|
||||
It("reports an email share as an email share type", func() {
|
||||
q := r.URL.Query()
|
||||
q.Add("$select", "@libre.graph.shareTypes")
|
||||
r.URL.RawQuery = q.Encode()
|
||||
@@ -614,10 +614,10 @@ var _ = Describe("Driveitems", func() {
|
||||
}, nil)
|
||||
|
||||
res := assertItemsList(1)
|
||||
Expect(res.Value[0].LibreGraphShareTypes).To(ConsistOf("guest"))
|
||||
Expect(res.Value[0].LibreGraphShareTypes).To(ConsistOf("email"))
|
||||
})
|
||||
|
||||
It("reports user and guest shares as separate share types", func() {
|
||||
It("reports user and email shares as separate share types", func() {
|
||||
q := r.URL.Query()
|
||||
q.Add("$select", "@libre.graph.shareTypes")
|
||||
r.URL.RawQuery = q.Encode()
|
||||
@@ -639,7 +639,7 @@ var _ = Describe("Driveitems", func() {
|
||||
}, nil)
|
||||
|
||||
res := assertItemsList(1)
|
||||
Expect(res.Value[0].LibreGraphShareTypes).To(Equal([]string{"user", "guest"}))
|
||||
Expect(res.Value[0].LibreGraphShareTypes).To(Equal([]string{"user", "email"}))
|
||||
})
|
||||
|
||||
It("reports only the link when the item has no grants", func() {
|
||||
|
||||
Generated
Vendored
+2
-2
@@ -1538,8 +1538,8 @@ func mdToPropResponse(ctx context.Context, pf *XML, md *provider.ResourceInfo, p
|
||||
types.WriteString("<oc:share-type>" + strconv.Itoa(int(conversions.ShareTypeUser)) + "</oc:share-type>")
|
||||
case "2": // provider.GranteeType_GRANTEE_TYPE_GROUP
|
||||
types.WriteString("<oc:share-type>" + strconv.Itoa(int(conversions.ShareTypeGroup)) + "</oc:share-type>")
|
||||
case "4": // conversions.ShareTypeGuest, guest shares are stored as user grants
|
||||
types.WriteString("<oc:share-type>" + strconv.Itoa(int(conversions.ShareTypeGuest)) + "</oc:share-type>")
|
||||
case "4": // conversions.ShareTypeEmail, guest shares are stored as user grants
|
||||
types.WriteString("<oc:share-type>" + strconv.Itoa(int(conversions.ShareTypeEmail)) + "</oc:share-type>")
|
||||
default:
|
||||
sublog.Debug().Interface("shareType", shareType).Msg("unknown share type, ignoring")
|
||||
}
|
||||
|
||||
+2
-2
@@ -61,8 +61,8 @@ const (
|
||||
// ShareTypeSpaceMembershipGroup represents an action regarding group type space members
|
||||
ShareTypeSpaceMembershipGroup ShareType = 8
|
||||
|
||||
// ShareTypeGuest represents a guest share
|
||||
ShareTypeGuest ShareType = 4
|
||||
// ShareTypeEmail represents a share to an guest email address (magic-link guest without a user account)
|
||||
ShareTypeEmail ShareType = 4
|
||||
|
||||
// ShareWithUserTypeUser represents a normal user
|
||||
ShareWithUserTypeUser ShareWithUserType = 0
|
||||
|
||||
+1
-1
@@ -1018,7 +1018,7 @@ func (n *Node) AsResourceInfo(ctx context.Context, rp *provider.ResourcePermissi
|
||||
if !first {
|
||||
s.WriteString(",")
|
||||
}
|
||||
s.WriteString(strconv.Itoa(int(conversions.ShareTypeGuest)))
|
||||
s.WriteString(strconv.Itoa(int(conversions.ShareTypeEmail)))
|
||||
}
|
||||
ri.Opaque = utils.AppendPlainToOpaque(ri.Opaque, "share-types", s.String())
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user