From 583f1dc954e1f2c0bad723c5828fac078178e969 Mon Sep 17 00:00:00 2001 From: amrita-shrestha Date: Tue, 4 Feb 2025 15:34:34 +0545 Subject: [PATCH 1/3] add tests for filtering permission of project resource --- .../features/apiOcm/listPermissions.feature | 374 +++++++++++++----- .../apiSharingNg1/filterPermissions.feature | 246 ++++++++++++ 2 files changed, 518 insertions(+), 102 deletions(-) diff --git a/tests/acceptance/features/apiOcm/listPermissions.feature b/tests/acceptance/features/apiOcm/listPermissions.feature index 7f383dae98c..4056110b172 100644 --- a/tests/acceptance/features/apiOcm/listPermissions.feature +++ b/tests/acceptance/features/apiOcm/listPermissions.feature @@ -1,4 +1,4 @@ -@ocm +@ocm @issue-9898 Feature: List a federated sharing permissions As a user I want to list the permissions for federated share @@ -7,7 +7,7 @@ Feature: List a federated sharing permissions Background: Given user "Alice" has been created with default attributes - @issue-9898 + Scenario: user lists permissions of a resource shared to a federated user Given using server "LOCAL" And "Alice" has created the federation share invitation @@ -121,71 +121,110 @@ Feature: List a federated sharing permissions } """ - @issue-9745 @env-config - Scenario: user lists allowed file permissions for federated user + + Scenario: user lists permissions of a resource shared to a federated user Given using server "LOCAL" - And the administrator has enabled the permissions role "Secure Viewer" - And user "Alice" has uploaded file with content "ocm test" to "/textfile.txt" - When user "Alice" gets the allowed roles for federated user of file "textfile.txt" from the space "Personal" using the Graph API + And "Alice" has created the federation share invitation + And using server "REMOTE" + And user "Brian" has been created with default attributes + And "Brian" has accepted invitation + And using server "LOCAL" + And user "Alice" has created folder "/uploadFolder" + And user "Alice" has sent the following resource share invitation to federated user: + | resource | uploadFolder | + | space | Personal | + | sharee | Brian | + | shareType | user | + | permissionsRole | Editor | + When user "Alice" gets permissions list for folder "uploadFolder" of the space "Personal" using the Graph API Then the HTTP status code should be "200" And the JSON data of the response should match """ { "type": "object", - "required": [ - "@libre.graph.permissions.roles.allowedValues" - ], - "properties": { - "@libre.graph.permissions.roles.allowedValues": { - "type": "array", - "minItems": 2, - "maxItems": 2, - "uniqueItems": true, - "items": { - "oneOf":[ + "required": [ + "@libre.graph.permissions.actions.allowedValues", + "@libre.graph.permissions.roles.allowedValues", + "value" + ], + "properties": { + "value": { + "type": "array", + "minItems": 1, + "maxItems": 1, + "uniqueItems": true, + "items": { + "oneOf":[ { "type": "object", "required": [ - "@libre.graph.weight", - "description", - "displayName", - "id" + "grantedToV2", + "id", + "roles" ], "properties": { - "@libre.graph.weight": { - "const": 1 - }, - "description": { - "const": "View and download." - }, - "displayName": { - "const": "Can view" + "grantedToV2": { + "type": "object", + "required": ["user"], + "properties": { + "user": { + "type": "object", + "required": ["@libre.graph.userType","displayName","id"], + "properties": { + "@libre.graph.userType": { + "const": "Federated" + }, + "id": { + "type": "string", + "pattern": "^%federated_user_id_pattern%$" + }, + "displayName": { + "const": "Brian Murphy" + } + } + } + } }, "id": { - "const": "b1e2218d-eef8-4d4c-b82d-0f1a1b48f3b5" - } - } - }, - { - "type": "object", - "required": [ - "@libre.graph.weight", - "description", - "displayName", - "id" - ], - "properties": { - "@libre.graph.weight": { - "const": 2 + "type": "string", + "pattern": "^%user_id_pattern%$" }, - "description": { - "const": "View, download and edit." + "invitation": { + "type": "object", + "required": ["invitedBy"], + "properties": { + "invitedBy": { + "type": "object", + "required": ["user"], + "properties": { + "user": { + "type": "object", + "required": ["@libre.graph.userType", "displayName", "id"], + "properties": { + "@libre.graph.userType": { + "const": "Member" + }, + "id": { + "type": "string", + "pattern": "^%user_id_pattern%$" + }, + "displayName": { + "const": "Alice Hansen" + } + } + } + } + } + } }, - "displayName": { - "const": "Can edit" - }, - "id": { - "const": "2d00ce52-1fc2-4dbc-8b95-a73b73395f5a" + "roles": { + "type": "array", + "minItems": 1, + "maxItems": 1, + "items": { + "type": "string", + "pattern": "^%role_id_pattern%$" + } } } } @@ -196,71 +235,108 @@ Feature: List a federated sharing permissions } """ - @issue-9745 - Scenario: user lists allowed folder permissions for federated user + + Scenario: user lists permissions of a project resource shared to a federated user Given using server "LOCAL" - And the administrator has enabled the permissions role "Secure Viewer" - And user "Alice" has created folder "folderToShare" - When user "Alice" gets the allowed roles for federated user of folder "folderToShare" from the space "Personal" using the Graph API + And "Alice" has created the federation share invitation + And using server "REMOTE" + And user "Brian" has been created with default attributes + And "Brian" has accepted invitation + And using server "LOCAL" + And using spaces DAV path + And the administrator has assigned the role "Space Admin" to user "Alice" using the Graph API + And user "Alice" has created a space "projectSpace" with the default quota using the Graph API + And user "Alice" has created a folder "folderToShare" in space "projectSpace" + And user "Alice" has sent the following resource share invitation to federated user: + | resource | folderToShare | + | space | projectSpace | + | sharee | Brian | + | shareType | user | + | permissionsRole | Viewer | + When user "Alice" gets permissions list for folder "folderToShare" of the space "projectSpace" using the Graph API Then the HTTP status code should be "200" And the JSON data of the response should match """ { "type": "object", - "required": [ - "@libre.graph.permissions.roles.allowedValues" - ], - "properties": { - "@libre.graph.permissions.roles.allowedValues": { - "type": "array", - "minItems": 2, - "maxItems": 2, - "uniqueItems": true, - "items": { - "oneOf":[ + "required": [ + "@libre.graph.permissions.actions.allowedValues", + "@libre.graph.permissions.roles.allowedValues", + "value" + ], + "properties": { + "value": { + "type": "array", + "minItems": 1, + "maxItems": 1, + "uniqueItems": true, + "items": { + "oneOf":[ { "type": "object", "required": [ - "@libre.graph.weight", - "description", - "displayName", - "id" + "grantedToV2", + "id", + "roles" ], "properties": { - "@libre.graph.weight": { - "const": 1 - }, - "description": { - "const": "View and download." - }, - "displayName": { - "const": "Can view" + "grantedToV2": { + "type": "object", + "required": ["user"], + "properties": { + "user": { + "type": "object", + "required": ["@libre.graph.userType","displayName","id"], + "properties": { + "@libre.graph.userType": { + "const": "Federated" + }, + "id": { + "type": "string", + "pattern": "^%federated_user_id_pattern%$" + }, + "displayName": { + "const": "Brian Murphy" + } + } + } + } }, "id": { - "const": "b1e2218d-eef8-4d4c-b82d-0f1a1b48f3b5" - } - } - }, - { - "type": "object", - "required": [ - "@libre.graph.weight", - "description", - "displayName", - "id" - ], - "properties": { - "@libre.graph.weight": { - "const": 2 + "type": "string", + "pattern": "^%user_id_pattern%$" }, - "description": { - "const": "View, download, upload, edit, add and delete." + "invitation": { + "type": "object", + "required": ["invitedBy"], + "properties": { + "invitedBy": { + "type": "object", + "required": ["user"], + "properties": { + "user": { + "type": "object", + "required": ["@libre.graph.userType", "displayName", "id"], + "properties": { + "@libre.graph.userType": { + "const": "Member" + }, + "id": { + "type": "string", + "pattern": "^%user_id_pattern%$" + }, + "displayName": { "const": "Alice Hansen" } + } + } + } + } + } }, - "displayName": { - "const": "Can edit" - }, - "id": { - "const": "fb6c3e19-e378-47e5-b277-9732f9de6e21" + "roles": { + "type": "array", + "minItems": 1, + "maxItems": 1, + "items": { "pattern": "^%role_id_pattern%$" } } } } @@ -270,3 +346,97 @@ Feature: List a federated sharing permissions } } """ + + + Scenario: user lists permissions of a project resource shared to a federated user + Given using server "LOCAL" + And "Alice" has created the federation share invitation + And using server "REMOTE" + And user "Brian" has been created with default attributes + And "Brian" has accepted invitation + And using server "LOCAL" + And using spaces DAV path + And the administrator has assigned the role "Space Admin" to user "Alice" using the Graph API + And user "Alice" has created a space "projectSpace" with the default quota using the Graph API + And user "Alice" has uploaded a file inside space "projectSpace" with content "some content" to "textfile.txt" + And user "Alice" has sent the following resource share invitation to federated user: + | resource | textfile.txt | + | space | projectSpace | + | sharee | Brian | + | shareType | user | + | permissionsRole | Viewer | + When user "Alice" gets permissions list for file "textfile.txt" of the space "projectSpace" using the Graph API + Then the HTTP status code should be "200" + And the JSON data of the response should match + """ + { + "type": "object", + "required": [ + "@libre.graph.permissions.actions.allowedValues", + "@libre.graph.permissions.roles.allowedValues", + "value" + ], + "properties": { + "value": { + "type": "array", + "minItems": 1, + "maxItems": 1, + "uniqueItems": true, + "items": { + "oneOf":[ + { + "type": "object", + "required": ["grantedToV2", "id", "roles"], + "properties": { + "grantedToV2": { + "type": "object", + "required": ["user"], + "properties": { + "user": { + "type": "object", + "required": ["@libre.graph.userType","displayName","id"], + "properties": { + "@libre.graph.userType": { "const": "Federated" }, + "id": { "pattern": "^%federated_user_id_pattern%$" }, + "displayName": { "const": "Brian Murphy" } + } + } + } + }, + "id": { "pattern": "^%user_id_pattern%$" }, + "invitation": { + "type": "object", + "required": ["invitedBy"], + "properties": { + "invitedBy": { + "type": "object", + "required": ["user"], + "properties": { + "user": { + "type": "object", + "required": ["@libre.graph.userType", "displayName", "id"], + "properties": { + "@libre.graph.userType": { "const": "Member" }, + "id": { "pattern": "^%user_id_pattern%$" }, + "displayName": { "const": "Alice Hansen" } + } + } + } + } + } + }, + "roles": { + "type": "array", + "minItems": 1, + "maxItems": 1, + "items": { "pattern": "^%role_id_pattern%$" } + } + } + } + ] + } + } + } + } + """ + diff --git a/tests/acceptance/features/apiSharingNg1/filterPermissions.feature b/tests/acceptance/features/apiSharingNg1/filterPermissions.feature index 0030a9b2e62..7d7eb3798f0 100644 --- a/tests/acceptance/features/apiSharingNg1/filterPermissions.feature +++ b/tests/acceptance/features/apiSharingNg1/filterPermissions.feature @@ -1166,3 +1166,249 @@ Feature: filter sharing permissions } } """ + + @issue-9745 @env-config + Scenario: user lists allowed file permissions for federated user + Given the administrator has enabled the permissions role "Secure Viewer" + And user "Alice" has uploaded file with content "ocm test" to "/textfile.txt" + When user "Alice" lists permissions with following filters for file "textfile.txt" of the space "Personal" using the Graph API: + | $filter=@libre.graph.permissions.roles.allowedValues/rolePermissions/any(p:contains(p/condition,+'@Subject.UserType=="Federated"')) | + | $select=@libre.graph.permissions.roles.allowedValue | + Then the HTTP status code should be "200" + And the JSON data of the response should match + """ + { + "type": "object", + "required": [ + "@libre.graph.permissions.roles.allowedValues" + ], + "properties": { + "@libre.graph.permissions.roles.allowedValues": { + "type": "array", + "minItems": 2, + "maxItems": 2, + "uniqueItems": true, + "items": { + "oneOf":[ + { + "type": "object", + "required": [ + "@libre.graph.weight", + "description", + "displayName", + "id" + ], + "properties": { + "@libre.graph.weight": { "const": 1 }, + "description": { "const": "View and download." }, + "displayName": { "const": "Can view" }, + "id": { "const": "b1e2218d-eef8-4d4c-b82d-0f1a1b48f3b5" } + } + }, + { + "type": "object", + "required": [ + "@libre.graph.weight", + "description", + "displayName", + "id" + ], + "properties": { + "@libre.graph.weight": { "const": 2 }, + "description": { "const": "View, download and edit." }, + "displayName": { "const": "Can edit" }, + "id": { "const": "2d00ce52-1fc2-4dbc-8b95-a73b73395f5a" } + } + } + ] + } + } + } + } + """ + + @issue-9745 @env-config + Scenario: user lists allowed folder permissions for federated user + Given the administrator has enabled the permissions role "Denied" + And user "Alice" has created folder "folderToShare" + When user "Alice" lists permissions with following filters for folder "folderToShare" of the space "Personal" using the Graph API: + | $filter=@libre.graph.permissions.roles.allowedValues/rolePermissions/any(p:contains(p/condition,+'@Subject.UserType=="Federated"')) | + | $select=@libre.graph.permissions.roles.allowedValue | + Then the HTTP status code should be "200" + And the JSON data of the response should match + """ + { + "type": "object", + "required": [ + "@libre.graph.permissions.roles.allowedValues" + ], + "properties": { + "@libre.graph.permissions.roles.allowedValues": { + "type": "array", + "minItems": 2, + "maxItems": 2, + "uniqueItems": true, + "items": { + "oneOf":[ + { + "type": "object", + "required": [ + "@libre.graph.weight", + "description", + "displayName", + "id" + ], + "properties": { + "@libre.graph.weight": { "const": 1 }, + "description": { "const": "View and download." }, + "displayName": { "const": "Can view" }, + "id": { "const": "b1e2218d-eef8-4d4c-b82d-0f1a1b48f3b5" } + } + }, + { + "type": "object", + "required": [ + "@libre.graph.weight", + "description", + "displayName", + "id" + ], + "properties": { + "@libre.graph.weight": { "const": 2 }, + "description": { "const": "View, download, upload, edit, add and delete." }, + "displayName": { "const": "Can edit" }, + "id": { "const": "fb6c3e19-e378-47e5-b277-9732f9de6e21" } + } + } + ] + } + } + } + } + """ + + @issue-9745 @env-config + Scenario: user lists allowed file permissions for federated user (Project Space) + Given using spaces DAV path + And the administrator has enabled the permissions role "Secure Viewer" + And the administrator has assigned the role "Space Admin" to user "Alice" using the Graph API + And user "Alice" has created a space "new-space" with the default quota using the Graph API + And user "Alice" has uploaded a file inside space "new-space" with content "some content" to "textfile.txt" + When user "Alice" lists permissions with following filters for file "textfile.txt" of the space "new-space" using the Graph API: + | $filter=@libre.graph.permissions.roles.allowedValues/rolePermissions/any(p:contains(p/condition,+'@Subject.UserType=="Federated"')) | + | $select=@libre.graph.permissions.roles.allowedValue | + Then the HTTP status code should be "200" + And the JSON data of the response should match + """ + { + "type": "object", + "required": [ + "@libre.graph.permissions.roles.allowedValues" + ], + "properties": { + "@libre.graph.permissions.roles.allowedValues": { + "type": "array", + "minItems": 2, + "maxItems": 2, + "uniqueItems": true, + "items": { + "oneOf":[ + { + "type": "object", + "required": [ + "@libre.graph.weight", + "description", + "displayName", + "id" + ], + "properties": { + "@libre.graph.weight": { "const": 1 }, + "description": { "const": "View and download." }, + "displayName": { "const": "Can view" }, + "id": { "const": "b1e2218d-eef8-4d4c-b82d-0f1a1b48f3b5" } + } + }, + { + "type": "object", + "required": [ + "@libre.graph.weight", + "description", + "displayName", + "id" + ], + "properties": { + "@libre.graph.weight": { "const": 2 }, + "description": { "const": "View, download and edit." }, + "displayName": { "const": "Can edit" }, + "id": { "const": "2d00ce52-1fc2-4dbc-8b95-a73b73395f5a" } + } + } + ] + } + } + } + } + """ + + @issue-9745 @env-config + Scenario: user lists allowed folder permissions for federated user (Project Space) + Given using spaces DAV path + And the administrator has enabled the permissions role "Denied" + And the administrator has assigned the role "Space Admin" to user "Alice" using the Graph API + And user "Alice" has created a space "new-space" with the default quota using the Graph API + And user "Alice" has created a folder "folderToShare" in space "new-space" + When user "Alice" lists permissions with following filters for folder "folderToShare" of the space "new-space" using the Graph API: + | $filter=@libre.graph.permissions.roles.allowedValues/rolePermissions/any(p:contains(p/condition,+'@Subject.UserType=="Federated"')) | + | $select=@libre.graph.permissions.roles.allowedValue | + Then the HTTP status code should be "200" + And the JSON data of the response should match + """ + { + "type": "object", + "required": [ + "@libre.graph.permissions.roles.allowedValues" + ], + "properties": { + "@libre.graph.permissions.roles.allowedValues": { + "type": "array", + "minItems": 2, + "maxItems": 2, + "uniqueItems": true, + "items": { + "oneOf":[ + { + "type": "object", + "required": [ + "@libre.graph.weight", + "description", + "displayName", + "id" + ], + "properties": { + "@libre.graph.weight": { "const": 1 }, + "description": { "const": "View and download." }, + "displayName": { "const": "Can view" }, + "id": { "const": "b1e2218d-eef8-4d4c-b82d-0f1a1b48f3b5" } + } + }, + { + "type": "object", + "required": [ + "@libre.graph.weight", + "description", + "displayName", + "id" + ], + "properties": { + "@libre.graph.weight": { "const": 2 }, + "description": { "const": "View, download, upload, edit, add and delete." }, + "displayName": { "const": "Can edit" }, + "id": { "const": "fb6c3e19-e378-47e5-b277-9732f9de6e21" } + } + } + ] + } + } + } + } + """ From b95e3b703bc141d3eda765f906b1a8642991811b Mon Sep 17 00:00:00 2001 From: amrita-shrestha Date: Thu, 6 Feb 2025 09:41:26 +0545 Subject: [PATCH 2/3] compress json scheme --- .../features/apiOcm/listPermissions.feature | 224 +++--------------- .../apiSharingNg1/filterPermissions.feature | 120 ++++------ 2 files changed, 70 insertions(+), 274 deletions(-) diff --git a/tests/acceptance/features/apiOcm/listPermissions.feature b/tests/acceptance/features/apiOcm/listPermissions.feature index 4056110b172..9dc0223bd1c 100644 --- a/tests/acceptance/features/apiOcm/listPermissions.feature +++ b/tests/acceptance/features/apiOcm/listPermissions.feature @@ -6,15 +6,14 @@ Feature: List a federated sharing permissions Background: Given user "Alice" has been created with default attributes - - - Scenario: user lists permissions of a resource shared to a federated user - Given using server "LOCAL" And "Alice" has created the federation share invitation And using server "REMOTE" And user "Brian" has been created with default attributes And "Brian" has accepted invitation - And using server "LOCAL" + + + Scenario: user lists permissions of a resource shared to a federated user + Given using server "LOCAL" And user "Alice" has uploaded file with content "ocm test" to "/textfile.txt" And user "Alice" has sent the following resource share invitation to federated user: | resource | textfile.txt | @@ -43,11 +42,7 @@ Feature: List a federated sharing permissions "oneOf":[ { "type": "object", - "required": [ - "grantedToV2", - "id", - "roles" - ], + "required": ["grantedToV2","id","roles"], "properties": { "grantedToV2": { "type": "object", @@ -57,24 +52,14 @@ Feature: List a federated sharing permissions "type": "object", "required": ["@libre.graph.userType","displayName","id"], "properties": { - "@libre.graph.userType": { - "const": "Federated" - }, - "id": { - "type": "string", - "pattern": "^%federated_user_id_pattern%$" - }, - "displayName": { - "const": "Brian Murphy" - } + "@libre.graph.userType": {"const": "Federated"}, + "id": {"pattern": "^%federated_user_id_pattern%$"}, + "displayName": {"const": "Brian Murphy"} } } } }, - "id": { - "type": "string", - "pattern": "^%user_id_pattern%$" - }, + "id": {"pattern": "^%user_id_pattern%$"}, "invitation": { "type": "object", "required": ["invitedBy"], @@ -87,16 +72,9 @@ Feature: List a federated sharing permissions "type": "object", "required": ["@libre.graph.userType", "displayName", "id"], "properties": { - "@libre.graph.userType": { - "const": "Member" - }, - "id": { - "type": "string", - "pattern": "^%user_id_pattern%$" - }, - "displayName": { - "const": "Alice Hansen" - } + "@libre.graph.userType": {"const": "Member"}, + "id": {"pattern": "^%user_id_pattern%$"}, + "displayName": {"const": "Alice Hansen"} } } } @@ -107,124 +85,7 @@ Feature: List a federated sharing permissions "type": "array", "minItems": 1, "maxItems": 1, - "items": { - "type": "string", - "pattern": "^%role_id_pattern%$" - } - } - } - } - ] - } - } - } - } - """ - - - Scenario: user lists permissions of a resource shared to a federated user - Given using server "LOCAL" - And "Alice" has created the federation share invitation - And using server "REMOTE" - And user "Brian" has been created with default attributes - And "Brian" has accepted invitation - And using server "LOCAL" - And user "Alice" has created folder "/uploadFolder" - And user "Alice" has sent the following resource share invitation to federated user: - | resource | uploadFolder | - | space | Personal | - | sharee | Brian | - | shareType | user | - | permissionsRole | Editor | - When user "Alice" gets permissions list for folder "uploadFolder" of the space "Personal" using the Graph API - Then the HTTP status code should be "200" - And the JSON data of the response should match - """ - { - "type": "object", - "required": [ - "@libre.graph.permissions.actions.allowedValues", - "@libre.graph.permissions.roles.allowedValues", - "value" - ], - "properties": { - "value": { - "type": "array", - "minItems": 1, - "maxItems": 1, - "uniqueItems": true, - "items": { - "oneOf":[ - { - "type": "object", - "required": [ - "grantedToV2", - "id", - "roles" - ], - "properties": { - "grantedToV2": { - "type": "object", - "required": ["user"], - "properties": { - "user": { - "type": "object", - "required": ["@libre.graph.userType","displayName","id"], - "properties": { - "@libre.graph.userType": { - "const": "Federated" - }, - "id": { - "type": "string", - "pattern": "^%federated_user_id_pattern%$" - }, - "displayName": { - "const": "Brian Murphy" - } - } - } - } - }, - "id": { - "type": "string", - "pattern": "^%user_id_pattern%$" - }, - "invitation": { - "type": "object", - "required": ["invitedBy"], - "properties": { - "invitedBy": { - "type": "object", - "required": ["user"], - "properties": { - "user": { - "type": "object", - "required": ["@libre.graph.userType", "displayName", "id"], - "properties": { - "@libre.graph.userType": { - "const": "Member" - }, - "id": { - "type": "string", - "pattern": "^%user_id_pattern%$" - }, - "displayName": { - "const": "Alice Hansen" - } - } - } - } - } - } - }, - "roles": { - "type": "array", - "minItems": 1, - "maxItems": 1, - "items": { - "type": "string", - "pattern": "^%role_id_pattern%$" - } + "items": {"pattern": "^%role_id_pattern%$"} } } } @@ -238,11 +99,6 @@ Feature: List a federated sharing permissions Scenario: user lists permissions of a project resource shared to a federated user Given using server "LOCAL" - And "Alice" has created the federation share invitation - And using server "REMOTE" - And user "Brian" has been created with default attributes - And "Brian" has accepted invitation - And using server "LOCAL" And using spaces DAV path And the administrator has assigned the role "Space Admin" to user "Alice" using the Graph API And user "Alice" has created a space "projectSpace" with the default quota using the Graph API @@ -288,24 +144,14 @@ Feature: List a federated sharing permissions "type": "object", "required": ["@libre.graph.userType","displayName","id"], "properties": { - "@libre.graph.userType": { - "const": "Federated" - }, - "id": { - "type": "string", - "pattern": "^%federated_user_id_pattern%$" - }, - "displayName": { - "const": "Brian Murphy" - } + "@libre.graph.userType": {"const": "Federated"}, + "id": {"pattern": "^%federated_user_id_pattern%$"}, + "displayName": {"const": "Brian Murphy"} } } } }, - "id": { - "type": "string", - "pattern": "^%user_id_pattern%$" - }, + "id": { "pattern": "^%user_id_pattern%$" }, "invitation": { "type": "object", "required": ["invitedBy"], @@ -318,14 +164,9 @@ Feature: List a federated sharing permissions "type": "object", "required": ["@libre.graph.userType", "displayName", "id"], "properties": { - "@libre.graph.userType": { - "const": "Member" - }, - "id": { - "type": "string", - "pattern": "^%user_id_pattern%$" - }, - "displayName": { "const": "Alice Hansen" } + "@libre.graph.userType": {"const": "Member"}, + "id": {"pattern": "^%user_id_pattern%$"}, + "displayName": {"const": "Alice Hansen"} } } } @@ -336,7 +177,7 @@ Feature: List a federated sharing permissions "type": "array", "minItems": 1, "maxItems": 1, - "items": { "pattern": "^%role_id_pattern%$" } + "items": {"pattern": "^%role_id_pattern%$"} } } } @@ -350,11 +191,6 @@ Feature: List a federated sharing permissions Scenario: user lists permissions of a project resource shared to a federated user Given using server "LOCAL" - And "Alice" has created the federation share invitation - And using server "REMOTE" - And user "Brian" has been created with default attributes - And "Brian" has accepted invitation - And using server "LOCAL" And using spaces DAV path And the administrator has assigned the role "Space Admin" to user "Alice" using the Graph API And user "Alice" has created a space "projectSpace" with the default quota using the Graph API @@ -386,7 +222,7 @@ Feature: List a federated sharing permissions "oneOf":[ { "type": "object", - "required": ["grantedToV2", "id", "roles"], + "required": ["grantedToV2","id","roles"], "properties": { "grantedToV2": { "type": "object", @@ -396,14 +232,14 @@ Feature: List a federated sharing permissions "type": "object", "required": ["@libre.graph.userType","displayName","id"], "properties": { - "@libre.graph.userType": { "const": "Federated" }, - "id": { "pattern": "^%federated_user_id_pattern%$" }, - "displayName": { "const": "Brian Murphy" } + "@libre.graph.userType": {"const": "Federated"}, + "id": {"pattern": "^%federated_user_id_pattern%$"}, + "displayName": {"const": "Brian Murphy"} } } } }, - "id": { "pattern": "^%user_id_pattern%$" }, + "id": {"pattern": "^%user_id_pattern%$"}, "invitation": { "type": "object", "required": ["invitedBy"], @@ -416,9 +252,9 @@ Feature: List a federated sharing permissions "type": "object", "required": ["@libre.graph.userType", "displayName", "id"], "properties": { - "@libre.graph.userType": { "const": "Member" }, - "id": { "pattern": "^%user_id_pattern%$" }, - "displayName": { "const": "Alice Hansen" } + "@libre.graph.userType": {"const": "Member"}, + "id": {"pattern": "^%user_id_pattern%$"}, + "displayName": {"const": "Alice Hansen"} } } } @@ -429,7 +265,7 @@ Feature: List a federated sharing permissions "type": "array", "minItems": 1, "maxItems": 1, - "items": { "pattern": "^%role_id_pattern%$" } + "items": {"pattern": "^%role_id_pattern%$"} } } } diff --git a/tests/acceptance/features/apiSharingNg1/filterPermissions.feature b/tests/acceptance/features/apiSharingNg1/filterPermissions.feature index 7d7eb3798f0..d5a32e0c5d5 100644 --- a/tests/acceptance/features/apiSharingNg1/filterPermissions.feature +++ b/tests/acceptance/features/apiSharingNg1/filterPermissions.feature @@ -1192,32 +1192,22 @@ Feature: filter sharing permissions "oneOf":[ { "type": "object", - "required": [ - "@libre.graph.weight", - "description", - "displayName", - "id" - ], + "required": ["@libre.graph.weight","description","displayName","id"], "properties": { - "@libre.graph.weight": { "const": 1 }, - "description": { "const": "View and download." }, - "displayName": { "const": "Can view" }, - "id": { "const": "b1e2218d-eef8-4d4c-b82d-0f1a1b48f3b5" } + "@libre.graph.weight": {"const": 1}, + "description": {"const": "View and download."}, + "displayName": {"const": "Can view"}, + "id": {"const": "b1e2218d-eef8-4d4c-b82d-0f1a1b48f3b5"} } }, { "type": "object", - "required": [ - "@libre.graph.weight", - "description", - "displayName", - "id" - ], + "required": ["@libre.graph.weight","description","displayName","id"], "properties": { - "@libre.graph.weight": { "const": 2 }, - "description": { "const": "View, download and edit." }, - "displayName": { "const": "Can edit" }, - "id": { "const": "2d00ce52-1fc2-4dbc-8b95-a73b73395f5a" } + "@libre.graph.weight": {"const": 2}, + "description": {"const": "View, download and edit."}, + "displayName": {"const": "Can edit"}, + "id": {"const": "2d00ce52-1fc2-4dbc-8b95-a73b73395f5a" } } } ] @@ -1252,32 +1242,22 @@ Feature: filter sharing permissions "oneOf":[ { "type": "object", - "required": [ - "@libre.graph.weight", - "description", - "displayName", - "id" - ], + "required": ["@libre.graph.weight","description","displayName","id"], "properties": { - "@libre.graph.weight": { "const": 1 }, - "description": { "const": "View and download." }, - "displayName": { "const": "Can view" }, - "id": { "const": "b1e2218d-eef8-4d4c-b82d-0f1a1b48f3b5" } + "@libre.graph.weight": {"const": 1}, + "description": {"const": "View and download."}, + "displayName": {"const": "Can view"}, + "id": {"const": "b1e2218d-eef8-4d4c-b82d-0f1a1b48f3b5"} } }, { "type": "object", - "required": [ - "@libre.graph.weight", - "description", - "displayName", - "id" - ], + "required": ["@libre.graph.weight","description","displayName","id"], "properties": { - "@libre.graph.weight": { "const": 2 }, - "description": { "const": "View, download, upload, edit, add and delete." }, - "displayName": { "const": "Can edit" }, - "id": { "const": "fb6c3e19-e378-47e5-b277-9732f9de6e21" } + "@libre.graph.weight": {"const": 2}, + "description": {"const": "View, download, upload, edit, add and delete."}, + "displayName": {"const": "Can edit"}, + "id": {"const": "fb6c3e19-e378-47e5-b277-9732f9de6e21"} } } ] @@ -1315,32 +1295,22 @@ Feature: filter sharing permissions "oneOf":[ { "type": "object", - "required": [ - "@libre.graph.weight", - "description", - "displayName", - "id" - ], + "required": ["@libre.graph.weight","description","displayName","id"], "properties": { - "@libre.graph.weight": { "const": 1 }, - "description": { "const": "View and download." }, - "displayName": { "const": "Can view" }, - "id": { "const": "b1e2218d-eef8-4d4c-b82d-0f1a1b48f3b5" } + "@libre.graph.weight": {"const": 1}, + "description": {"const": "View and download."}, + "displayName": {"const": "Can view"}, + "id": {"const": "b1e2218d-eef8-4d4c-b82d-0f1a1b48f3b5"} } }, { "type": "object", - "required": [ - "@libre.graph.weight", - "description", - "displayName", - "id" - ], + "required": ["@libre.graph.weight","description","displayName","id"], "properties": { - "@libre.graph.weight": { "const": 2 }, - "description": { "const": "View, download and edit." }, - "displayName": { "const": "Can edit" }, - "id": { "const": "2d00ce52-1fc2-4dbc-8b95-a73b73395f5a" } + "@libre.graph.weight": {"const": 2}, + "description": {"const": "View, download and edit."}, + "displayName": {"const": "Can edit"}, + "id": {"const": "2d00ce52-1fc2-4dbc-8b95-a73b73395f5a"} } } ] @@ -1378,32 +1348,22 @@ Feature: filter sharing permissions "oneOf":[ { "type": "object", - "required": [ - "@libre.graph.weight", - "description", - "displayName", - "id" - ], + "required": ["@libre.graph.weight","description","displayName","id"], "properties": { - "@libre.graph.weight": { "const": 1 }, - "description": { "const": "View and download." }, - "displayName": { "const": "Can view" }, - "id": { "const": "b1e2218d-eef8-4d4c-b82d-0f1a1b48f3b5" } + "@libre.graph.weight": {"const": 1}, + "description": {"const": "View and download."}, + "displayName": {"const": "Can view"}, + "id": {"const": "b1e2218d-eef8-4d4c-b82d-0f1a1b48f3b5"} } }, { "type": "object", - "required": [ - "@libre.graph.weight", - "description", - "displayName", - "id" - ], + "required": ["@libre.graph.weight","description","displayName","id"], "properties": { - "@libre.graph.weight": { "const": 2 }, - "description": { "const": "View, download, upload, edit, add and delete." }, - "displayName": { "const": "Can edit" }, - "id": { "const": "fb6c3e19-e378-47e5-b277-9732f9de6e21" } + "@libre.graph.weight": {"const": 2}, + "description": {"const": "View, download, upload, edit, add and delete."}, + "displayName": {"const": "Can edit"}, + "id": {"const": "fb6c3e19-e378-47e5-b277-9732f9de6e21"} } } ] From 703b38ee17d11b6e0849888a19c583f6266d1fdc Mon Sep 17 00:00:00 2001 From: amrita Date: Mon, 10 Feb 2025 11:56:41 +0545 Subject: [PATCH 3/3] remove unused step --- .../acceptance/bootstrap/SharingNgContext.php | 25 ------------------- 1 file changed, 25 deletions(-) diff --git a/tests/acceptance/bootstrap/SharingNgContext.php b/tests/acceptance/bootstrap/SharingNgContext.php index 47d618d3186..8515d71e8a5 100644 --- a/tests/acceptance/bootstrap/SharingNgContext.php +++ b/tests/acceptance/bootstrap/SharingNgContext.php @@ -2111,31 +2111,6 @@ class SharingNgContext implements Context { } } - /** - * @When /^user "([^"]*)" gets the allowed roles for federated user of (folder|file) "([^"]*)" from the space "([^"]*)" using the Graph API$/ - * - * @param string $user - * @param string $fileOrFolder (file|folder) - * @param string $resource - * @param string $space - * - * @return void - * @throws Exception - */ - public function userGetsFederatedPermissionsListForFileOfTheSpaceUsingTheGraphApi( - string $user, - string $fileOrFolder, - string $resource, - string $space - ): void { - $query = '$filter=@libre.graph.permissions.roles.allowedValues' - . '/rolePermissions/any(p:contains(p/condition,+\'@Subject.UserType=="Federated"\'))' - . '&$select=@libre.graph.permissions.roles.allowedValues'; - $this->featureContext->setResponse( - $this->getPermissionsList($user, $fileOrFolder, $space, $resource, $query) - ); - } - /** * @When /^user "([^"]*)" lists permissions with following filters for (folder|file) "([^"]*)" of the space "([^"]*)" using the Graph API:$/ *