Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[tests-only][full-ci]Add tests for filtering permission of project resource #10961

Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
296 changes: 151 additions & 145 deletions tests/acceptance/features/apiOcm/listPermissions.feature
Original file line number Diff line number Diff line change
@@ -1,20 +1,19 @@
@ocm
@ocm @issue-9898
Feature: List a federated sharing permissions
As a user
I want to list the permissions for federated share
So that the federated share is assigned the correct 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
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 |
Expand Down Expand Up @@ -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",
Expand All @@ -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"],
Expand All @@ -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"}
}
}
}
Expand All @@ -107,10 +85,7 @@ Feature: List a federated sharing permissions
"type": "array",
"minItems": 1,
"maxItems": 1,
"items": {
"type": "string",
"pattern": "^%role_id_pattern%$"
}
"items": {"pattern": "^%role_id_pattern%$"}
}
}
}
Expand All @@ -121,71 +96,88 @@ 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 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 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 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":[
{
"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"
}
}
},
"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": 2
},
"description": {
"const": "View, download and edit."
"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"}
}
}
}
},
"displayName": {
"const": "Can edit"
"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"}
}
}
}
}
}
},
"id": {
"const": "2d00ce52-1fc2-4dbc-8b95-a73b73395f5a"
"roles": {
"type": "array",
"minItems": 1,
"maxItems": 1,
"items": {"pattern": "^%role_id_pattern%$"}
}
}
}
Expand All @@ -196,71 +188,84 @@ 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 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.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"
],
"required": ["grantedToV2","id","roles"],
"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."
"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"}
}
}
}
},
"displayName": {
"const": "Can edit"
"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"}
}
}
}
}
}
},
"id": {
"const": "fb6c3e19-e378-47e5-b277-9732f9de6e21"
"roles": {
"type": "array",
"minItems": 1,
"maxItems": 1,
"items": {"pattern": "^%role_id_pattern%$"}
}
}
}
Expand All @@ -270,3 +275,4 @@ Feature: List a federated sharing permissions
}
}
"""

Loading