Skip to content

Commit

Permalink
update test for issue-ocis-reva-260
Browse files Browse the repository at this point in the history
Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>
  • Loading branch information
butonic committed Nov 6, 2020
1 parent 887e82f commit 1b2c89c
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -692,7 +692,7 @@ func (h *Handler) listSharesWithMe(w http.ResponseWriter, r *http.Request) {

ctx := r.Context()

var info *provider.ResourceInfo
var pinfo *provider.ResourceInfo
p := r.URL.Query().Get("path")
// we need to lookup the resource id so we can filter the list of shares later
if p != "" {
Expand Down Expand Up @@ -732,7 +732,7 @@ func (h *Handler) listSharesWithMe(w http.ResponseWriter, r *http.Request) {
return
}

info = statRes.GetInfo()
pinfo = statRes.GetInfo()
}

lrsReq := collaboration.ListReceivedSharesRequest{}
Expand All @@ -754,14 +754,25 @@ func (h *Handler) listSharesWithMe(w http.ResponseWriter, r *http.Request) {
lrsRes.GetShares()

shares := make([]*conversions.ShareData, 0)

var info *provider.ResourceInfo
// TODO(refs) filter out "invalid" shares
for _, rs := range lrsRes.GetShares() {

if stateFilter != ocsStateUnknown && rs.GetState() != stateFilter {
continue
}

if info == nil {
if pinfo != nil {
// check if the shared resource matches the path resource
if rs.Share.ResourceId.StorageId != pinfo.GetId().StorageId ||
rs.Share.ResourceId.OpaqueId != pinfo.GetId().OpaqueId {
// try next share
continue
}
// we can reuse the stat info
info = pinfo
} else {
// we need to do a stat call
statRequest := provider.StatRequest{
Ref: &provider.Reference{
Spec: &provider.Reference_Id{
Expand All @@ -777,9 +788,6 @@ func (h *Handler) listSharesWithMe(w http.ResponseWriter, r *http.Request) {
}

info = statRes.GetInfo()
} else if rs.Share.ResourceId.StorageId != info.GetId().StorageId ||
rs.Share.ResourceId.OpaqueId != info.GetId().OpaqueId {
continue
}

data, err := conversions.UserShare2ShareData(r.Context(), rs.Share)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,31 +10,23 @@ Feature: sharing
And user "Alice" has uploaded file with content "text file 1" to "/textfile1.txt"
And user "Brian" has uploaded file with content "text file 0" to "/textfile0.txt"
And user "Brian" has uploaded file with content "text file 1" to "/textfile1.txt"
And the administrator has set the default folder for received shares to "Shares"
And auto-accept shares has been disabled

@issue-ocis-reva-260
# after fixing all issues delete this Scenario and use the one from oC10 core
Scenario Outline: Sharee can't see the share that is filtered out
Given using OCS API version "<ocs_api_version>"
And user "Alice" has shared file "textfile0.txt" with user "Brian"
And user "Brian" has accepted share "/textfile0.txt" offered by user "Alice"
And user "Alice" has shared file "textfile1.txt" with user "Brian"
When user "Brian" gets all the shares shared with him that are received as file "textfile0 (2).txt" using the provisioning API
And user "Brian" has accepted share "/textfile1.txt" offered by user "Alice"
When user "Brian" gets all the shares shared with him that are received as file "Shares/textfile0.txt" using the provisioning API
Then the OCS status code should be "<ocs_status_code>"
And the HTTP status code should be "200"
And the last share_id should be included in the response
Examples:
| ocs_api_version | ocs_status_code |
| 1 | 100 |

@issue-ocis-reva-260 @skipOnOcis-OCIS-Storage
# after fixing all issues delete this Scenario and use the one from oC10 core
Scenario Outline: Sharee can't see the share that is filtered out
Given using OCS API version "<ocs_api_version>"
And user "Alice" has shared file "textfile0.txt" with user "Brian"
And user "Alice" has shared file "textfile1.txt" with user "Brian"
When user "Brian" gets all the shares shared with him that are received as file "textfile0 (2).txt" using the provisioning API
Then the OCS status code should be "<ocs_status_code>"
And the HTTP status code should be "200"
And the last share_id should be included in the response
Examples:
| ocs_api_version | ocs_status_code |
| 2 | 200 |

0 comments on commit 1b2c89c

Please sign in to comment.