Skip to content

Commit

Permalink
compress json scheme
Browse files Browse the repository at this point in the history
  • Loading branch information
amrita-shrestha committed Feb 6, 2025
1 parent e7c166f commit fe2a69d
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 311 deletions.
282 changes: 19 additions & 263 deletions tests/acceptance/features/apiOcm/listPermissions.feature
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,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 +53,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 +73,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,124 +86,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%$"}
}
}
}
Expand Down Expand Up @@ -274,11 +136,7 @@ Feature: List a federated sharing permissions
"oneOf":[
{
"type": "object",
"required": [
"grantedToV2",
"id",
"roles"
],
"required": ["grantedToV2","id","roles"],
"properties": {
"grantedToV2": {
"type": "object",
Expand All @@ -288,16 +146,9 @@ 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"}
}
}
}
Expand All @@ -318,14 +169,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 @@ -336,100 +182,10 @@ Feature: List a federated sharing permissions
"type": "array",
"minItems": 1,
"maxItems": 1,
"items": { "pattern": "^%role_id_pattern%$" }
}
}
}
]
}
}
}
}
"""


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" }
}
}
}
}
"items": {
"type": "string",
"pattern": "^%role_id_pattern%$"
}
},
"roles": {
"type": "array",
"minItems": 1,
"maxItems": 1,
"items": { "pattern": "^%role_id_pattern%$" }
}
}
}
Expand Down
Loading

0 comments on commit fe2a69d

Please sign in to comment.