add tests for sharing with list grants roles

This commit is contained in:
amrita committed 2025-04-02 13:33:36 +05:45
1 parent eb70b76835
commit c3bc7bd7d6
2 files changed
+249 -1

No files matched your search

+4 -1
View File
@@ -45,7 +45,10 @@ class GraphHelper {
'Space Editor Without Versions' => '3284f2d5-0070-4ad8-ac40-c247f7c1fb27',
'Denied' => '63e64e19-8d43-42ec-a738-2b6af2610efa',
'Editor With Versions' => '0911d62b-1e3f-4778-8b1b-903b7e4e8476',
'File Editor With Versions' => 'b173329d-cf2e-42f0-a595-ee410645d840'
'File Editor With Versions' => 'b173329d-cf2e-42f0-a595-ee410645d840',
'Viewer With ListGrants' => 'd5041006-ebb3-4b4a-b6a4-7c180ecfb17d',
'Editor With ListGrants' => 'e8ea8b21-abd4-45d2-b893-8d1546378e9e',
'File Editor With ListGrants' => 'c1235aea-d106-42db-8458-7d5610fb0a67'
];
public const SHARING_LINK_TYPE_MAPPINGS = [
@@ -0,0 +1,245 @@
@env-config
Feature: ListGrants role
As a user
I want to share resources with listGrants role
So that sharee can view activities and grants list of shared resources
Background:
Given these users have been created with default attributes:
| username |
| Alice |
| Brian |
Scenario Outline: user shares personal space file with ListGrants role
Given the administrator has enabled the permissions role "<permissions-role>"
And user "Alice" has uploaded file with content "to share" to "textfile1.txt"
When user "Alice" sends the following resource share invitation using the Graph API:
| resource | textfile1.txt |
| space | Personal |
| sharee | Brian |
| shareType | user |
| permissionsRole | <permissions-role> |
Then the HTTP status code should be "200"
And the JSON data of the response should match
"""
{
"type": "object",
"required": ["value"],
"properties": {
"value": {
"type": "array",
"maxItems": 1,
"minItems": 1,
"items": {
"type": "object",
"required": ["createdDateTime","id","roles","grantedToV2"],
"properties": {
"id": {"pattern": "^%permissions_id_pattern%$"},
"roles": {
"type": "array",
"maxItems": 1,
"minItems": 1,
"items": {"pattern": "^%role_id_pattern%$"}
},
"grantedToV2": {
"type": "object",
"required": ["user"],
"properties": {
"user": {
"type": "object",
"required": ["id","displayName"],
"properties": {
"id": {"pattern": "^%user_id_pattern%$"},
"displayName": {"const": "Brian Murphy"}
}
}
}
}
}
}
}
}
}
"""
Examples:
| permissions-role |
| Viewer With ListGrants |
| File Editor With ListGrants |
Scenario Outline: user shares personal space folder with ListGrants role
Given the administrator has enabled the permissions role "<permissions-role>"
And user "Alice" has created folder "FolderToShare"
When user "Alice" sends the following resource share invitation using the Graph API:
| resource | FolderToShare |
| space | Personal |
| sharee | Brian |
| shareType | user |
| permissionsRole | <permissions-role> |
Then the HTTP status code should be "200"
And the JSON data of the response should match
"""
{
"type": "object",
"required": ["value"],
"properties": {
"value": {
"type": "array",
"maxItems": 1,
"minItems": 1,
"items": {
"type": "object",
"required": ["createdDateTime","id","roles","grantedToV2"],
"properties": {
"id": {"pattern": "^%permissions_id_pattern%$"},
"roles": {
"type": "array",
"maxItems": 1,
"minItems": 1,
"items": {"pattern": "^%role_id_pattern%$"}
},
"grantedToV2": {
"type": "object",
"required": ["user"],
"properties": {
"user": {
"type": "object",
"required": ["id","displayName"],
"properties": {
"id": {"pattern": "^%user_id_pattern%$"},
"displayName": {"const": "Brian Murphy"}
}
}
}
}
}
}
}
}
}
"""
Examples:
| permissions-role |
| Viewer With ListGrants |
| Editor With ListGrants |
Scenario Outline: user shares project space file with ListGrants role
Given the administrator has enabled the permissions role "<permissions-role>"
And the administrator has assigned the role "Space Admin" to user "Alice" using the Graph API
And using spaces DAV path
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 "share space items" to "textfile1.txt"
When user "Alice" sends the following resource share invitation using the Graph API:
| resource | textfile1.txt |
| space | NewSpace |
| sharee | Brian |
| shareType | user |
| permissionsRole | <permissions-role> |
Then the HTTP status code should be "200"
And the JSON data of the response should match
"""
{
"type": "object",
"required": ["value"],
"properties": {
"value": {
"type": "array",
"maxItems": 1,
"minItems": 1,
"items": {
"type": "object",
"required": ["createdDateTime","id","roles","grantedToV2"],
"properties": {
"id": {"pattern": "^%permissions_id_pattern%$"},
"roles": {
"type": "array",
"maxItems": 1,
"minItems": 1,
"items": {"pattern": "^%role_id_pattern%$"}
},
"grantedToV2": {
"type": "object",
"required": ["user"],
"properties": {
"user": {
"type": "object",
"required": ["id","displayName"],
"properties": {
"id": {"pattern": "^%user_id_pattern%$"},
"displayName": {"const": "Brian Murphy"}
}
}
}
}
}
}
}
}
}
"""
Examples:
| permissions-role |
| Viewer With ListGrants |
| File Editor With ListGrants |
Scenario Outline: user shares project space folder with ListGrants role
Given the administrator has enabled the permissions role "<permissions-role>"
And the administrator has assigned the role "Space Admin" to user "Alice" using the Graph API
And using spaces DAV path
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"
When user "Alice" sends the following resource share invitation using the Graph API:
| resource | FolderToShare |
| space | NewSpace |
| sharee | Brian |
| shareType | user |
| permissionsRole | <permissions-role> |
Then the HTTP status code should be "200"
And the JSON data of the response should match
"""
{
"type": "object",
"required": ["value"],
"properties": {
"value": {
"type": "array",
"maxItems": 1,
"minItems": 1,
"items": {
"type": "object",
"required": ["createdDateTime","id","roles","grantedToV2"],
"properties": {
"id": {"pattern": "^%permissions_id_pattern%$"},
"roles": {
"type": "array",
"maxItems": 1,
"minItems": 1,
"items": {"pattern": "^%role_id_pattern%$"}
},
"grantedToV2": {
"type": "object",
"required": ["user"],
"properties": {
"user": {
"type": "object",
"required": ["id","displayName"],
"properties": {
"id": {"pattern": "^%user_id_pattern%$"},
"displayName": {"const": "Brian Murphy"}
}
}
}
}
}
}
}
}
}
"""
Examples:
| permissions-role |
| Viewer With ListGrants |
| Editor With ListGrants |