Repository: owncloud/ocis
Pull request #8413 (2024-02-08 20:56:47)

fix the bug when the expiration dates can't be removed from link perm…
…issions

<!--
Thanks for submitting a change to ownCloud!

This is the bug tracker for the oCIS component. Find other components at https://github.com/owncloud/core/blob/master/.github/CONTRIBUTING.md#guidelines

For fixing potential security issues please see https://owncloud.org/security/

To make it possible for us to get your change reviewed and merged please carefully fill out the requested information below.

Please note that any kind of change needs first be submitted to the master branch which holds the next version of oCIS.

Please set the following labels:

- Set label "Status:Needs-Review" for review or "Status:In-Progress" if the PR still has open tasks.
- Assignment: assign to self
- Reviewers: pick at least one
-->

## Description
<!--- Describe your changes in detail -->

## Related Issue
<!--- This project only accepts pull requests related to open issues -->
<!--- If suggesting a new feature or change, please discuss it in an issue first -->
<!--- If fixing a bug, there should be an issue describing it with steps to reproduce -->
<!--- Please link to the issue here: -->
- Fixes [https://github.com/owncloud/ocis/issues/8405](https://github.com/owncloud/ocis/issues/8405)

## Motivation and Context
<!--- Why is this change required? What problem does it solve? -->

## How Has This Been Tested?
<!--- Please describe in detail how you tested your changes. -->
<!--- Include details of your testing environment, and the tests you ran to -->
<!--- see how your change affects other areas of the code, etc. -->
- test environment:
- test case 1:
- test case 2:
- ...

## Screenshots (if appropriate):

## Types of changes
<!--- What types of changes does your code introduce? Put an `x` in all the boxes that apply: -->
- [X] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to change)
- [ ] Technical debt
- [ ] Tests only (no source changes)

## Checklist:
<!-- Tick the checkboxes when done. -->
<!-- Raise documentation ticket in owncloud.github.io/ -->
- [X] Code changes
- [ ] Unit tests added
- [ ] Acceptance tests added
- [ ] Documentation ticket raised: <link> 


sonarcloud[bot]: ## [![Quality Gate Passed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/qg-passed-20px.png 'Quality Gate Passed')](https://sonarcloud.io/dashboard?id=owncloud_ocis&pullRequest=8413) **Quality Gate passed**  
Issues  
![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [0 New issues](https://sonarcloud.io/project/issues?id=owncloud_ocis&pullRequest=8413&resolved=false&inNewCodePeriod=true)

Measures  
![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=owncloud_ocis&pullRequest=8413&resolved=false&inNewCodePeriod=true)  
![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [100.0% Coverage on New Code](https://sonarcloud.io/component_measures?id=owncloud_ocis&pullRequest=8413&metric=new_coverage&view=list)  
![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [0.0% Duplication on New Code](https://sonarcloud.io/component_measures?id=owncloud_ocis&pullRequest=8413&metric=new_duplicated_lines_density&view=list)  
  
[See analysis details on SonarCloud](https://sonarcloud.io/dashboard?id=owncloud_ocis&pullRequest=8413)


sonarcloud[bot]: ## [![Quality Gate Passed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/qg-passed-20px.png 'Quality Gate Passed')](https://sonarcloud.io/dashboard?id=owncloud_ocis&pullRequest=8413) **Quality Gate passed**  
Issues  
![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [0 New issues](https://sonarcloud.io/project/issues?id=owncloud_ocis&pullRequest=8413&resolved=false&inNewCodePeriod=true)

Measures  
![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=owncloud_ocis&pullRequest=8413&resolved=false&inNewCodePeriod=true)  
![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [100.0% Coverage on New Code](https://sonarcloud.io/component_measures?id=owncloud_ocis&pullRequest=8413&metric=new_coverage&view=list)  
![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [0.0% Duplication on New Code](https://sonarcloud.io/component_measures?id=owncloud_ocis&pullRequest=8413&metric=new_duplicated_lines_density&view=list)  
  
[See analysis details on SonarCloud](https://sonarcloud.io/dashboard?id=owncloud_ocis&pullRequest=8413)



Patch:
diff --git a/CHANGELOG.md b/CHANGELOG.md
index b4e81947be6..2ce8099c513 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -40,6 +40,7 @@ The following sections list the changes for unreleased.
 
 ## Summary
 
+* Bugfix - Fix search response: [#7815](https://github.com/owncloud/ocis/pull/7815)
 * Bugfix - The race conditions in tests: [#7847](https://github.com/owncloud/ocis/pull/7847)
 * Bugfix - Fix jwt config of policies service: [#7893](https://github.com/owncloud/ocis/pull/7893)
 * Bugfix - Fix Service Account Roles on external IDP: [#8074](https://github.com/owncloud/ocis/pull/8074)
@@ -79,6 +80,13 @@ The following sections list the changes for unreleased.
 
 ## Details
 
+* Bugfix - Fix search response: [#7815](https://github.com/owncloud/ocis/pull/7815)
+
+   We fixed the search response code from 500 to 400 when the request is invalid
+
+   https://github.com/owncloud/ocis/issues/7812
+   https://github.com/owncloud/ocis/pull/7815
+
 * Bugfix - The race conditions in tests: [#7847](https://github.com/owncloud/ocis/pull/7847)
 
    We fixed the race conditions in tests.
diff --git a/changelog/unreleased/fix-search-responce.md b/changelog/unreleased/fix-search-responce.md
new file mode 100644
index 00000000000..e7f308a153c
--- /dev/null
+++ b/changelog/unreleased/fix-search-responce.md
@@ -0,0 +1,6 @@
+Bugfix: Fix search response
+
+We fixed the search response code from 500 to 400 when the request is invalid
+
+https://github.com/owncloud/ocis/pull/7815
+https://github.com/owncloud/ocis/issues/7812
diff --git a/changelog/unreleased/sharing-ng-expirationdate.md b/changelog/unreleased/sharing-ng-expirationdate.md
new file mode 100644
index 00000000000..f917b3111cc
--- /dev/null
+++ b/changelog/unreleased/sharing-ng-expirationdate.md
@@ -0,0 +1,6 @@
+Bugfix: graph/drives/permission Expiration date update
+
+We fixed a bug in the Update sharing permission the expiration dates can't be removed from link permissions.
+
+https://github.com/owncloud/ocis/pull/8413
+https://github.com/owncloud/ocis/issues/8405
diff --git a/docs/services/general-info/env-var-deltas/4.0.0-5.0.0-added.adoc b/docs/services/general-info/env-var-deltas/4.0.0-5.0.0-added.adoc
index 6edb3679c80..061e54b1c53 100644
--- a/docs/services/general-info/env-var-deltas/4.0.0-5.0.0-added.adoc
+++ b/docs/services/general-info/env-var-deltas/4.0.0-5.0.0-added.adoc
@@ -8,9 +8,18 @@
 |===
 | Service| Variable| Description| Default
 
-| Available in multiple services
+| xref:deployment/services/env-vars-special-scope.adoc[Special Scope Envvars]
 | `OCIS_CACHE_DISABLE_PERSISTENCE`
 | Disables persistence of the cache. Only applies when store type 'nats-js-kv' is configured.| `false`
+|
+| `MICRO_REGISTRY` (important change)
+| The Go micro registry type to use. Supported types are: 'memory', 'nats-js-kv' (default) and 'kubernetes'. Note that 'nats', 'etcd', 'consul' and 'mdns' are deprecated and will be removed in a later version. Only change on supervision of ownCloud Support.| nats-js-kv
+|
+| `MICRO_REGISTRY_AUTH_PASSWORD`
+| Optional when using nats to authenticate with the nats cluster.|
+|
+| `MICRO_REGISTRY_AUTH_USERNAME`
+| Optional when using nats to authenticate with the nats cluster.|
 
 | xref:{s-path}/antivirus.adoc[antivirus]
 | `OCIS_EVENTS_AUTH_USERNAME`
diff --git a/docs/services/general-info/env-var-deltas/4.0.0-5.0.0-added.md b/docs/services/general-info/env-var-deltas/4.0.0-5.0.0-added.md
index 004a659e158..a58a4ef27a4 100644
--- a/docs/services/general-info/env-var-deltas/4.0.0-5.0.0-added.md
+++ b/docs/services/general-info/env-var-deltas/4.0.0-5.0.0-added.md
@@ -3,9 +3,12 @@
 | File                                          | Variable                                                                                                                                                                                           | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                 | Default                               |
 |-----------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------|
 | ocis-pkg/shared/shared_types.go               | `OCIS_CACHE_DISABLE_PERSISTENCE`                                                                                                                                                                   | Disables persistence of the cache. Only applies when store type 'nats-js-kv' is configured.                                                                                                                                                                                                                                                                                                                                                                                 | `false`                               |
+| ocis-pkg/registry/registry.go                 | `MICRO_REGISTRY` (important change)                                                                                                                                                                | The Go micro registry type to use. Supported types are: 'memory', 'nats-js-kv' (default) and 'kubernetes'. Note that 'nats', 'etcd', 'consul' and 'mdns' are deprecated and will be removed in a later version. Only change on supervision of ownCloud Support.                                                                                                                                                                                                                                                                                                                                                                                    | `nats-js-kv`                          |
+| ocis-pkg/natsjsregistry/registry.go           | `MICRO_REGISTRY_AUTH_USERNAME`                                                                                                                                                                     | Optional when using nats to authenticate with the nats cluster.                                                                                                                                                                                                                                                                                                                         |                                       |
+|                                               | `MICRO_REGISTRY_AUTH_PASSWORD`                                                                                                                                                                     | Optional when using nats to authenticate with the nats cluster.                                                                                                                                                                                                                                                                                                                         |                                       |
 | services/antivirus/pkg/config/config.go       | `OCIS_EVENTS_AUTH_USERNAME`                                                                                                                                                                        | The username to authenticate with the events broker. The events broker is the ocis service which receives and delivers events between the services.                                                                                                                                                                                                                                                                                                                         |                                       |
 |                                               | `OCIS_EVENTS_AUTH_PASSWORD`                                                                                                                                                                        | The password to authenticate with the events broker. The events broker is the ocis service which receives and delivers events between the services.                                                                                                                                                                                                                                                                                                                         |                                       |
-|                                               | `ANTIVIRUS_ICAP_TIMEOUT`                                                                                                                                                                        | Scan timeout for the ICAP client. Defaults to '5m' (5 minutes). See the Environment Variable Types description for more details.                                                                                                                                                                                                                                                                                                                         |                                       |
+|                                               | `ANTIVIRUS_ICAP_TIMEOUT`                                                                                                                                                                           | Scan timeout for the ICAP client. Defaults to '5m' (5 minutes). See the Environment Variable Types description for more details.                                                                                                                                                                                                                                                                                                                         |                                       |
 | services/audit/pkg/config/config.go           | `OCIS_EVENTS_AUTH_USERNAME`                                                                                                                                                                        | The username to authenticate with the events broker. The events broker is the ocis service which receives and delivers events between the services.                                                                                                                                                                                                                                                                                                                         |                                       |
 |                                               | `OCIS_EVENTS_AUTH_PASSWORD`                                                                                                                                                                        | The password to authenticate with the events broker. The events broker is the ocis service which receives and delivers events between the services.                                                                                                                                                                                                                                                                                                                         |                                       |
 | services/auth-service/pkg/config/config.go    | `OCIS_TRACING_ENABLED;AUTH_SERVICE_TRACING_ENABLED`                                                                                                                                                | Activates tracing.                                                                                                                                                                                                                                                                                                                                                                                                                                                          |                                       |
diff --git a/services/graph/pkg/service/v0/links.go b/services/graph/pkg/service/v0/links.go
index f9303fa5c77..684dd8e67be 100644
--- a/services/graph/pkg/service/v0/links.go
+++ b/services/graph/pkg/service/v0/links.go
@@ -202,7 +202,7 @@ func (g Graph) libreGraphPermissionFromCS3PublicShare(createdLink *link.PublicSh
 }
 
 func parseAndFillUpTime(t *time.Time) *types.Timestamp {
-	if t == nil {
+	if t == nil || t.IsZero() {
 		return nil
 	}
 
diff --git a/services/search/pkg/engine/bleve.go b/services/search/pkg/engine/bleve.go
index a0b3f26f30c..54375d99250 100644
--- a/services/search/pkg/engine/bleve.go
+++ b/services/search/pkg/engine/bleve.go
@@ -22,6 +22,7 @@ import (
 	storageProvider "github.com/cs3org/go-cs3apis/cs3/storage/provider/v1beta1"
 	"google.golang.org/protobuf/types/known/timestamppb"
 
+	"github.com/cs3org/reva/v2/pkg/errtypes"
 	"github.com/cs3org/reva/v2/pkg/storagespace"
 	"github.com/cs3org/reva/v2/pkg/utils"
 
@@ -123,6 +124,9 @@ func BuildBleveMapping() (mapping.IndexMapping, error) {
 func (b *Bleve) Search(ctx context.Context, sir *searchService.SearchIndexRequest) (*searchService.SearchIndexResponse, error) {
 	createdQuery, err := b.queryCreator.Create(sir.Query)
 	if err != nil {
+		if searchQuery.IsValidationError(err) {
+			return nil, errtypes.BadRequest(err.Error())
+		}
 		return nil, err
 	}
 
diff --git a/services/search/pkg/query/kql/error.go b/services/search/pkg/query/error.go
similarity index 82%
rename from services/search/pkg/query/kql/error.go
rename to services/search/pkg/query/error.go
index 5f171d77fdb..89f504c8a45 100644
--- a/services/search/pkg/query/kql/error.go
+++ b/services/search/pkg/query/error.go
@@ -1,4 +1,4 @@
-package kql
+package query
 
 import (
 	"fmt"
@@ -37,3 +37,11 @@ type UnsupportedTimeRangeError struct {
 func (e UnsupportedTimeRangeError) Error() string {
 	return fmt.Sprintf("unable to convert '%v' to a time range", e.Value)
 }
+
+func IsValidationError(err error) bool {
+	switch err.(type) {
+	case *StartsWithBinaryOperatorError, *NamedGroupInvalidNodesError, *UnsupportedTimeRangeError:
+		return true
+	}
+	return false
+}
diff --git a/services/search/pkg/query/kql/cast.go b/services/search/pkg/query/kql/cast.go
index 06fb800ce5a..c6ca30541ac 100644
--- a/services/search/pkg/query/kql/cast.go
+++ b/services/search/pkg/query/kql/cast.go
@@ -5,6 +5,7 @@ import (
 	"time"
 
 	"github.com/jinzhu/now"
+	"github.com/owncloud/ocis/v2/services/search/pkg/query"
 
 	"github.com/owncloud/ocis/v2/services/search/pkg/query/ast"
 )
@@ -84,7 +85,7 @@ func toTimeRange(in interface{}) (*time.Time, *time.Time, error) {
 
 	value, err := toString(in)
 	if err != nil {
-		return &from, &to, UnsupportedTimeRangeError{}
+		return &from, &to, &query.UnsupportedTimeRangeError{}
 	}
 
 	c := &now.Config{
@@ -131,7 +132,7 @@ func toTimeRange(in interface{}) (*time.Time, *time.Time, error) {
 	}
 
 	if from.IsZero() || to.IsZero() {
-		return nil, nil, UnsupportedTimeRangeError{}
+		return nil, nil, &query.UnsupportedTimeRangeError{}
 	}
 
 	return &from, &to, nil
diff --git a/services/search/pkg/query/kql/validate.go b/services/search/pkg/query/kql/validate.go
index 9e9a2428b99..96c6761ab17 100644
--- a/services/search/pkg/query/kql/validate.go
+++ b/services/search/pkg/query/kql/validate.go
@@ -1,6 +1,7 @@
 package kql
 
 import (
+	"github.com/owncloud/ocis/v2/services/search/pkg/query"
 	"github.com/owncloud/ocis/v2/services/search/pkg/query/ast"
 )
 
@@ -9,10 +10,9 @@ func validateAst(a *ast.Ast) error {
 	case *ast.OperatorNode:
 		switch node.Value {
 		case BoolAND, BoolOR:
-			return StartsWithBinaryOperatorError{Node: node}
+			return &query.StartsWithBinaryOperatorError{Node: node}
 		}
 	}
-
 	return nil
 }
 
@@ -21,14 +21,14 @@ func validateGroupNode(n *ast.GroupNode) error {
 	case *ast.OperatorNode:
 		switch node.Value {
 		case BoolAND, BoolOR:
-			return StartsWithBinaryOperatorError{Node: node}
+			return &query.StartsWithBinaryOperatorError{Node: node}
 		}
 	}
 
 	if n.Key != "" {
 		for _, node := range n.Nodes {
 			if ast.NodeKey(node) != "" {
-				return NamedGroupInvalidNodesError{Node: node}
+				return &query.NamedGroupInvalidNodesError{Node: node}
 			}
 		}
 	}


Test patch:
diff --git a/services/search/pkg/query/kql/dictionary_test.go b/services/search/pkg/query/kql/dictionary_test.go
index ba2780db895..adf4bd2d45e 100644
--- a/services/search/pkg/query/kql/dictionary_test.go
+++ b/services/search/pkg/query/kql/dictionary_test.go
@@ -6,6 +6,7 @@ import (
 	"time"
 
 	"github.com/jinzhu/now"
+	"github.com/owncloud/ocis/v2/services/search/pkg/query"
 	tAssert "github.com/stretchr/testify/assert"
 
 	"github.com/owncloud/ocis/v2/services/search/pkg/query/ast"
@@ -34,13 +35,13 @@ func TestParse_Spec(t *testing.T) {
 		},
 		{
 			name: `AND`,
-			error: kql.StartsWithBinaryOperatorError{
+			error: query.StartsWithBinaryOperatorError{
 				Node: &ast.OperatorNode{Value: kql.BoolAND},
 			},
 		},
 		{
 			name: `AND cat AND dog`,
-			error: kql.StartsWithBinaryOperatorError{
+			error: query.StartsWithBinaryOperatorError{
 				Node: &ast.OperatorNode{Value: kql.BoolAND},
 			},
 		},
@@ -80,13 +81,13 @@ func TestParse_Spec(t *testing.T) {
 		},
 		{
 			name: `OR`,
-			error: kql.StartsWithBinaryOperatorError{
+			error: query.StartsWithBinaryOperatorError{
 				Node: &ast.OperatorNode{Value: kql.BoolOR},
 			},
 		},
 		{
 			name: `OR cat AND dog`,
-			error: kql.StartsWithBinaryOperatorError{
+			error: query.StartsWithBinaryOperatorError{
 				Node: &ast.OperatorNode{Value: kql.BoolOR},
 			},
 		},
@@ -862,37 +863,37 @@ func TestParse_Errors(t *testing.T) {
 	tests := []testCase{
 		{
 			query: "animal:(mammal:cat mammal:dog reptile:turtle)",
-			error: kql.NamedGroupInvalidNodesError{
+			error: query.NamedGroupInvalidNodesError{
 				Node: &ast.StringNode{Key: "mammal", Value: "cat"},
 			},
 		},
 		{
 			query: "animal:(cat mammal:dog turtle)",
-			error: kql.NamedGroupInvalidNodesError{
+			error: query.NamedGroupInvalidNodesError{
 				Node: &ast.StringNode{Key: "mammal", Value: "dog"},
 			},
 		},
 		{
 			query: "animal:(AND cat)",
-			error: kql.StartsWithBinaryOperatorError{
+			error: query.StartsWithBinaryOperatorError{
 				Node: &ast.OperatorNode{Value: kql.BoolAND},
 			},
 		},
 		{
 			query: "animal:(OR cat)",
-			error: kql.StartsWithBinaryOperatorError{
+			error: query.StartsWithBinaryOperatorError{
 				Node: &ast.OperatorNode{Value: kql.BoolOR},
 			},
 		},
 		{
 			query: "(AND cat)",
-			error: kql.StartsWithBinaryOperatorError{
+			error: query.StartsWithBinaryOperatorError{
 				Node: &ast.OperatorNode{Value: kql.BoolAND},
 			},
 		},
 		{
 			query: "(OR cat)",
-			error: kql.StartsWithBinaryOperatorError{
+			error: query.StartsWithBinaryOperatorError{
 				Node: &ast.OperatorNode{Value: kql.BoolOR},
 			},
 		},
diff --git a/services/search/pkg/query/kql/kql_test.go b/services/search/pkg/query/kql/kql_test.go
index de050a47413..c130f755820 100644
--- a/services/search/pkg/query/kql/kql_test.go
+++ b/services/search/pkg/query/kql/kql_test.go
@@ -3,6 +3,7 @@ package kql_test
 import (
 	"testing"
 
+	"github.com/owncloud/ocis/v2/services/search/pkg/query"
 	tAssert "github.com/stretchr/testify/assert"
 
 	"github.com/owncloud/ocis/v2/services/search/pkg/query/ast"
@@ -22,7 +23,7 @@ func TestNewAST(t *testing.T) {
 		{
 			name:       "error",
 			givenQuery: kql.BoolAND,
-			expectedError: kql.StartsWithBinaryOperatorError{
+			expectedError: query.StartsWithBinaryOperatorError{
 				Node: &ast.OperatorNode{Value: kql.BoolAND},
 			},
 		},
diff --git a/tests/acceptance/expected-failures-localAPI-on-OCIS-storage.md b/tests/acceptance/expected-failures-localAPI-on-OCIS-storage.md
index 6f729a599af..b8789d196a8 100644
--- a/tests/acceptance/expected-failures-localAPI-on-OCIS-storage.md
+++ b/tests/acceptance/expected-failures-localAPI-on-OCIS-storage.md
@@ -249,19 +249,19 @@ The expected failures in this file are from features in the owncloud/ocis repo.
 
 ### [blocksDownload link type is not implemented yet (sharing-ng)](https://github.com/owncloud/ocis/issues/7879)
 
-- [apiSharingNg/linkShare.feature:79](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSharingNg/linkShare.feature#L79)
-- [apiSharingNg/linkShare.feature:149](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSharingNg/linkShare.feature#L149)
-- [apiSharingNg/linkShare.feature:228](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSharingNg/linkShare.feature#L228)
-- [apiSharingNg/linkShare.feature:305](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSharingNg/linkShare.feature#L305)
-- [apiSharingNg/linkShare.feature:377](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSharingNg/linkShare.feature#L377)
-- [apiSharingNg/linkShare.feature:451](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSharingNg/linkShare.feature#L451)
-- [apiSharingNg/linkShare.feature:453](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSharingNg/linkShare.feature#L453)
-- [apiSharingNg/linkShare.feature:455](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSharingNg/linkShare.feature#L455)
-- [apiSharingNg/linkShare.feature:456](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSharingNg/linkShare.feature#L456)
-- [apiSharingNg/deletePermissions.feature:130](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSharingNg/deletePermissions.feature#L130)
-- [apiSharingNg/deletePermissions.feature:147](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSharingNg/deletePermissions.feature#L147)
-- [apiSharingNg/deletePermissions.feature:168](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSharingNg/deletePermissions.feature#L168)
-- [apiSharingNg/deletePermissions.feature:187](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSharingNg/deletePermissions.feature#L187)
+- [apiSharingNg/linkShare.feature:78](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSharingNg/linkShare.feature#L78)
+- [apiSharingNg/linkShare.feature:147](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSharingNg/linkShare.feature#L147)
+- [apiSharingNg/linkShare.feature:225](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSharingNg/linkShare.feature#L225)
+- [apiSharingNg/linkShare.feature:301](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSharingNg/linkShare.feature#L301)
+- [apiSharingNg/linkShare.feature:372](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSharingNg/linkShare.feature#L372)
+- [apiSharingNg/linkShare.feature:444](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSharingNg/linkShare.feature#L444)
+- [apiSharingNg/linkShare.feature:446](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSharingNg/linkShare.feature#L446)
+- [apiSharingNg/linkShare.feature:448](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSharingNg/linkShare.feature#L448)
+- [apiSharingNg/linkShare.feature:449](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSharingNg/linkShare.feature#L449)
+- [apiSharingNg/deletePermissions.feature:125](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSharingNg/deletePermissions.feature#L125)
+- [apiSharingNg/deletePermissions.feature:141](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSharingNg/deletePermissions.feature#L141)
+- [apiSharingNg/deletePermissions.feature:161](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSharingNg/deletePermissions.feature#L161)
+- [apiSharingNg/deletePermissions.feature:179](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSharingNg/deletePermissions.feature#L179)
 
 ### [sharee (editor role) MOVE a file by file-id into same shared folder returns 403](https://github.com/owncloud/ocis/issues/7617)
 
diff --git a/tests/acceptance/features/apiSharingNg/deletePermissions.feature b/tests/acceptance/features/apiSharingNg/deletePermissions.feature
index 222514e4c43..ffc90cb1277 100644
--- a/tests/acceptance/features/apiSharingNg/deletePermissions.feature
+++ b/tests/acceptance/features/apiSharingNg/deletePermissions.feature
@@ -13,23 +13,22 @@ Feature: Remove access to a drive item
     Given user "Alice" has created folder "FolderToShare"
     And user "Alice" has uploaded file "filesForUpload/textfile.txt" to "textfile.txt"
     And user "Alice" has sent the following share invitation:
-      | resourceType    | <resource-type>   |
       | resource        | <path>            |
       | space           | Personal          |
       | sharee          | Brian             |
       | shareType       | user              |
       | permissionsRole | <permissionsRole> |
-    When user "Alice" removes the share permission of user "Brian" from <resource-type> "<path>" of space "Personal" using the Graph API
+    When user "Alice" removes the share permission of user "Brian" from resource "<path>" of space "Personal" using the Graph API
     Then the HTTP status code should be "204"
     And for user "Brian" the space "Shares" should not contain these entries:
       | <path> |
     Examples:
-      | permissionsRole | resource-type | path          |
-      | Viewer          | file          | textfile.txt  |
-      | File Editor     | file          | textfile.txt  |
-      | Viewer          | folder        | FolderToShare |
-      | Editor          | folder        | FolderToShare |
-      | Uploader        | folder        | FolderToShare |
+      | permissionsRole | path          |
+      | Viewer          | textfile.txt  |
+      | File Editor     | textfile.txt  |
+      | Viewer          | FolderToShare |
+      | Editor          | FolderToShare |
+      | Uploader        | FolderToShare |
 
 
   Scenario Outline: user removes access to resource inside of a project space in the user share
@@ -38,23 +37,22 @@ Feature: Remove access to a drive item
     And user "Alice" has created a folder "FolderToShare" in space "NewSpace"
     And user "Alice" has uploaded a file inside space "NewSpace" with content "some content" to "textfile.txt"
     And user "Alice" has sent the following share invitation:
-      | resourceType    | <resource-type>   |
       | resource        | <path>            |
       | space           | NewSpace          |
       | sharee          | Brian             |
       | shareType       | user              |
       | permissionsRole | <permissionsRole> |
-    When user "Alice" removes the share permission of user "Brian" from <resource-type> "<path>" of space "NewSpace" using the Graph API
+    When user "Alice" removes the share permission of user "Brian" from resource "<path>" of space "NewSpace" using the Graph API
     Then the HTTP status code should be "204"
     And for user "Brian" the space "Shares" should not contain these entries:
       | <path> |
     Examples:
-      | permissionsRole | resource-type | path          |
-      | Viewer          | file          | textfile.txt  |
-      | File Editor     | file          | textfile.txt  |
-      | Viewer          | folder        | FolderToShare |
-      | Editor          | folder        | FolderToShare |
-      | Uploader        | folder        | FolderToShare |
+      | permissionsRole | path          |
+      | Viewer          | textfile.txt  |
+      | File Editor     | textfile.txt  |
+      | Viewer          | FolderToShare |
+      | Editor          | FolderToShare |
+      | Uploader        | FolderToShare |
 
 
   Scenario Outline: user removes access to a resource in a group share
@@ -64,23 +62,22 @@ Feature: Remove access to a drive item
     And user "Alice" has created folder "FolderToShare"
     And user "Alice" has uploaded file "filesForUpload/textfile.txt" to "textfile.txt"
     And user "Alice" has sent the following share invitation:
-      | resourceType    | <resource-type>   |
       | resource        | <path>            |
       | space           | Personal          |
       | sharee          | group1            |
       | shareType       | group             |
       | permissionsRole | <permissionsRole> |
-    When user "Alice" removes the share permission of group "group1" from <resource-type> "<path>" of space "Personal" using the Graph API
+    When user "Alice" removes the share permission of group "group1" from resource "<path>" of space "Personal" using the Graph API
     Then the HTTP status code should be "204"
     And for user "Brian" the space "Shares" should not contain these entries:
       | <path> |
     Examples:
-      | permissionsRole | resource-type | path          |
-      | Viewer          | file          | textfile.txt  |
-      | File Editor     | file          | textfile.txt  |
-      | Viewer          | folder        | FolderToShare |
-      | Editor          | folder        | FolderToShare |
-      | Uploader        | folder        | FolderToShare |
+      | permissionsRole | path          |
+      | Viewer          | textfile.txt  |
+      | File Editor     | textfile.txt  |
+      | Viewer          | FolderToShare |
+      | Editor          | FolderToShare |
+      | Uploader        | FolderToShare |
 
 
   Scenario Outline: user removes access to a resource inside of a project space in group share
@@ -92,29 +89,27 @@ Feature: Remove access to a drive item
     And user "Brian" has been added to group "group1"
     And user "Alice" has been added to group "group1"
     And user "Alice" has sent the following share invitation:
-      | resourceType    | <resource-type>   |
       | resource        | <path>            |
       | space           | NewSpace          |
       | sharee          | group1            |
       | shareType       | group             |
       | permissionsRole | <permissionsRole> |
-    When user "Alice" removes the share permission of group "group1" from <resource-type> "<path>" of space "NewSpace" using the Graph API
+    When user "Alice" removes the share permission of group "group1" from resource "<path>" of space "NewSpace" using the Graph API
     Then the HTTP status code should be "204"
     And for user "Brian" the space "Shares" should not contain these entries:
       | <path> |
     Examples:
-      | permissionsRole | resource-type | path          |
-      | Viewer          | file          | textfile.txt  |
-      | File Editor     | file          | textfile.txt  |
-      | Viewer          | folder        | FolderToShare |
-      | Editor          | folder        | FolderToShare |
-      | Uploader        | folder        | FolderToShare |
+      | permissionsRole | path          |
+      | Viewer          | textfile.txt  |
+      | File Editor     | textfile.txt  |
+      | Viewer          | FolderToShare |
+      | Editor          | FolderToShare |
+      | Uploader        | FolderToShare |
 
 
   Scenario Outline: user removes access to a folder in link share
     Given user "Alice" has created folder "FolderToShare"
     And user "Alice" has created the following link share:
-      | resourceType    | folder        |
       | resource        | FolderToShare |
       | space           | Personal      |
       | permissionsRole | <role>        |
@@ -133,7 +128,6 @@ Feature: Remove access to a drive item
   Scenario Outline: user removes access to a file in link share
     Given user "Alice" has uploaded file "filesForUpload/textfile.txt" to "textfile.txt"
     And user "Alice" has created the following link share:
-      | resourceType    | file              |
       | resource        | textfile.txt      |
       | space           | Personal          |
       | permissionsRole | <permissionsRole> |
@@ -152,7 +146,6 @@ Feature: Remove access to a drive item
     And user "Alice" has created a space "NewSpace" with the default quota using the Graph API
     And user "Alice" has created a folder "FolderToShare" in space "NewSpace"
     And user "Alice" has created the following link share:
-      | resourceType    | folder        |
       | resource        | FolderToShare |
       | space           | NewSpace      |
       | permissionsRole | <role>        |
@@ -173,7 +166,6 @@ Feature: Remove access to a drive item
     And user "Alice" has created a space "NewSpace" with the default quota using the Graph API
     And user "Alice" has uploaded a file inside space "NewSpace" with content "some content" to "textfile.txt"
     And user "Alice" has created the following link share:
-      | resourceType    | file              |
       | resource        | textfile.txt      |
       | space           | NewSpace          |
       | permissionsRole | <permissionsRole> |
diff --git a/tests/acceptance/features/apiSharingNg/linkShare.feature b/tests/acceptance/features/apiSharingNg/linkShare.feature
index b7259c17a94..23a419d97d9 100644
--- a/tests/acceptance/features/apiSharingNg/linkShare.feature
+++ b/tests/acceptance/features/apiSharingNg/linkShare.feature
@@ -10,7 +10,6 @@ Feature: Create a share link for a resource
   Scenario Outline: create a link share of a folder
     Given user "Alice" has created folder "folder"
     When user "Alice" creates the following link share using the Graph API:
-      | resourceType    | folder            |
       | resource        | folder            |
       | space           | Personal          |
       | permissionsRole | <permissionsRole> |
@@ -82,7 +81,6 @@ Feature: Create a share link for a resource
   Scenario Outline: create a link share of a file
     Given user "Alice" has uploaded file with content "other data" to "textfile1.txt"
     When user "Alice" creates the following link share using the Graph API:
-      | resourceType    | file              |
       | resource        | textfile1.txt     |
       | space           | Personal          |
       | permissionsRole | <permissionsRole> |
@@ -152,7 +150,6 @@ Feature: Create a share link for a resource
   Scenario Outline: create a link share of a folder with display name and expiry date
     Given user "Alice" has created folder "folder"
     When user "Alice" creates the following link share using the Graph API:
-      | resourceType       | folder                   |
       | resource           | folder                   |
       | space              | Personal                 |
       | permissionsRole    | <permissionsRole>        |
@@ -231,7 +228,6 @@ Feature: Create a share link for a resource
   Scenario Outline: create a link share of a file with display name and expiry date
     Given user "Alice" has uploaded file with content "other data" to "textfile1.txt"
     When user "Alice" creates the following link share using the Graph API:
-      | resourceType       | file                     |
       | resource           | textfile1.txt            |
       | space              | Personal                 |
       | permissionsRole    | <permissionsRole>        |
@@ -311,7 +307,6 @@ Feature: Create a share link for a resource
       | OCIS_SHARING_PUBLIC_SHARE_MUST_HAVE_PASSWORD | false |
     And user "Alice" has uploaded file with content "other data" to "textfile1.txt"
     When user "Alice" creates the following link share using the Graph API:
-      | resourceType    | file              |
       | resource        | textfile1.txt     |
       | space           | Personal          |
       | permissionsRole | <permissionsRole> |
@@ -380,13 +375,11 @@ Feature: Create a share link for a resource
   Scenario Outline: update role of a file's link share
     Given user "Alice" has uploaded file with content "other data" to "textfile1.txt"
     And user "Alice" has created the following link share:
-      | resourceType    | file                      |
       | resource        | textfile1.txt             |
       | space           | Personal                  |
       | permissionsRole | <previousPermissionsRole> |
       | password        | %public%                  |
     When user "Alice" updates the last public link share using the Graph API with
-      | resourceType    | file                 |
       | resource        | textfile1.txt        |
       | space           | Personal             |
       | permissionsRole | <newPermissionsRole> |
@@ -460,14 +453,12 @@ Feature: Create a share link for a resource
   Scenario: update expiration date of a file's link share
     Given user "Alice" has uploaded file with content "other data" to "textfile1.txt"
     And user "Alice" has created the following link share:
-      | resourceType       | file                     |
       | resource           | textfile1.txt            |
       | space              | Personal                 |
       | permissionsRole    | view                     |
       | password           | %public%                 |
       | expirationDateTime | 2200-07-15T14:00:00.000Z |
     When user "Alice" updates the last public link share using the Graph API with
-      | resourceType       | file                     |
       | resource           | textfile1.txt            |
       | space              | Personal                 |
       | expirationDateTime | 2201-07-15T14:00:00.000Z |
@@ -534,12 +525,10 @@ Feature: Create a share link for a resource
       | OCIS_SHARING_PUBLIC_SHARE_MUST_HAVE_PASSWORD | false |
     And user "Alice" has uploaded file with content "other data" to "textfile1.txt"
     And user "Alice" has created the following link share:
-      | resourceType    | file          |
       | resource        | textfile1.txt |
       | space           | Personal      |
       | permissionsRole | view          |
     When user "Alice" sets the following password for the last link share using the Graph API:
-      | resourceType | file          |
       | resource     | textfile1.txt |
       | space        | Personal      |
       | password     | %public%      |
@@ -564,13 +553,11 @@ Feature: Create a share link for a resource
   Scenario: update password of a file's link share
     Given user "Alice" has uploaded file with content "other data" to "textfile1.txt"
     And user "Alice" has created the following link share:
-      | resourceType    | file          |
       | resource        | textfile1.txt |
       | space           | Personal      |
       | permissionsRole | view          |
       | password        | $heLlo*1234*  |
     When user "Alice" sets the following password for the last link share using the Graph API:
-      | resourceType | file          |
       | resource     | textfile1.txt |
       | space        | Personal      |
       | password     | %public%      |
@@ -598,7 +585,6 @@ Feature: Create a share link for a resource
     Given the config "OCIS_PASSWORD_POLICY_BANNED_PASSWORDS_LIST" has been set to path "config/drone/banned-password-list.txt"
     And user "Alice" has uploaded file with content "other data" to "text.txt"
     When user "Alice" creates the following link share using the Graph API:
-      | resourceType    | file              |
       | resource        | text.txt          |
       | space           | Personal          |
       | permissionsRole | view              |
@@ -645,13 +631,11 @@ Feature: Create a share link for a resource
     Given the config "OCIS_PASSWORD_POLICY_BANNED_PASSWORDS_LIST" has been set to path "config/drone/banned-password-list.txt"
     And user "Alice" has uploaded file with content "other data" to "text.txt"
     And user "Alice" has created the following link share:
-      | resourceType    | file     |
       | resource        | text.txt |
       | space           | Personal |
       | permissionsRole | view     |
       | password        | %public% |
     When user "Alice" sets the following password for the last link share using the Graph API:
-      | resourceType    | file              |
       | resource        | text.txt          |
       | space           | Personal          |
       | permissionsRole | view              |
diff --git a/tests/acceptance/features/bootstrap/SharingNgContext.php b/tests/acceptance/features/bootstrap/SharingNgContext.php
index bdd91d4d597..4c6453ea1d4 100644
--- a/tests/acceptance/features/bootstrap/SharingNgContext.php
+++ b/tests/acceptance/features/bootstrap/SharingNgContext.php
@@ -65,15 +65,10 @@ class SharingNgContext implements Context {
 	public function createLinkShare(string $user, TableNode $body): ResponseInterface {
 		$bodyRows = $body->getRowsHash();
 		$space = $bodyRows['space'];
-		$resourceType = $bodyRows['resourceType'];
 		$resource = $bodyRows['resource'];
 
 		$spaceId = ($this->spacesContext->getSpaceByName($user, $space))["id"];
-		if ($resourceType === 'folder') {
-			$itemId = $this->spacesContext->getResourceId($user, $space, $resource);
-		} else {
-			$itemId = $this->spacesContext->getFileId($user, $space, $resource);
-		}
+		$itemId = $this->spacesContext->getResourceId($user, $space, $resource);
 
 		$bodyRows['displayName'] = $bodyRows['displayName'] ?? null;
 		$bodyRows['expirationDateTime'] = $bodyRows['expirationDateTime'] ?? null;
@@ -399,14 +394,9 @@ class SharingNgContext implements Context {
 	public function userSetsOrUpdatesFollowingPasswordForLastLinkShareUsingTheGraphApi(string $user, TableNode  $body):void {
 		$bodyRows = $body->getRowsHash();
 		$space = $bodyRows['space'];
-		$resourceType = $bodyRows['resourceType'];
 		$resource = $bodyRows['resource'];
 		$spaceId = ($this->spacesContext->getSpaceByName($user, $space))["id"];
-		if ($resourceType === 'folder') {
-			$itemId = $this->spacesContext->getResourceId($user, $space, $resource);
-		} else {
-			$itemId = $this->spacesContext->getFileId($user, $space, $resource);
-		}
+		$itemId = $this->spacesContext->getResourceId($user, $space, $resource);
 
 		if (\array_key_exists('password', $bodyRows)) {
 			$body = [
@@ -432,7 +422,6 @@ class SharingNgContext implements Context {
 	/**
 	 * @param string $sharer
 	 * @param string $shareType (user|group)
-	 * @param string $resourceType
 	 * @param string $resource
 	 * @param string $space
 	 * @param string|null $sharee can be both user or group
@@ -444,15 +433,12 @@ class SharingNgContext implements Context {
 	public function removeSharePermission(
 		string $sharer,
 		string $shareType,
-		string $resourceType,
 		string $resource,
 		string $space,
 		?string $sharee = null
 	): ResponseInterface {
 		$spaceId = ($this->spacesContext->getSpaceByName($sharer, $space))["id"];
-		$itemId = ($resourceType === 'folder')
-			? $this->spacesContext->getResourceId($sharer, $space, $resource)
-			: $this->spacesContext->getFileId($sharer, $space, $resource);
+		$itemId = $this->spacesContext->getResourceId($sharer, $space, $resource);
 
 		$permId = ($shareType === 'link')
 			? $this->featureContext->shareNgGetLastCreatedLinkShareID()
@@ -470,12 +456,11 @@ class SharingNgContext implements Context {
 	}
 
 	/**
-	 * @When /^user "([^"]*)" removes the share permission of (user|group) "([^"]*)" from (file|folder) "([^"]*)" of space "([^"]*)" using the Graph API$/
+	 * @When /^user "([^"]*)" removes the share permission of (user|group) "([^"]*)" from (?:file|folder|resource) "([^"]*)" of space "([^"]*)" using the Graph API$/
 	 *
 	 * @param string $sharer
 	 * @param string $shareType (user|group)
 	 * @param string $sharee can be both user or group
-	 * @param string $resourceType
 	 * @param string $resource
 	 * @param string $space
 	 *
@@ -487,20 +472,18 @@ class SharingNgContext implements Context {
 		string $sharer,
 		string $shareType,
 		string $sharee,
-		string $resourceType,
 		string $resource,
 		string $space
 	): void {
 		$this->featureContext->setResponse(
-			$this->removeSharePermission($sharer, $shareType, $resourceType, $resource, $space)
+			$this->removeSharePermission($sharer, $shareType, $resource, $space)
 		);
 	}
 
 	/**
-	 * @When /^user "([^"]*)" removes the share permission of link from (file|folder) "([^"]*)" of space "([^"]*)" using the Graph API$/
+	 * @When /^user "([^"]*)" removes the share permission of link from (?:file|folder) "([^"]*)" of space "([^"]*)" using the Graph API$/
 	 *
 	 * @param string $sharer
-	 * @param string $resourceType
 	 * @param string $resource
 	 * @param string $space
 	 *
@@ -510,12 +493,11 @@ class SharingNgContext implements Context {
 	 */
 	public function userRemovesSharePermissionOfAResourceInLinkShareUsingGraphAPI(
 		string $sharer,
-		string $resourceType,
 		string $resource,
 		string $space
 	):void {
 		$this->featureContext->setResponse(
-			$this->removeSharePermission($sharer, 'link', $resourceType, $resource, $space)
+			$this->removeSharePermission($sharer, 'link', $resource, $space)
 		);
 	}