Skip to content

Instantly share code, notes, and snippets.

@ewanharris
Created April 18, 2024 16:13
Show Gist options
  • Save ewanharris/58b39fb4679be0b46537c59c6c71247b to your computer and use it in GitHub Desktop.
Save ewanharris/58b39fb4679be0b46537c59c6c71247b to your computer and use it in GitHub Desktop.
Syntax
Feature: Check folder access
Background:
Given folder:5 is a parent of folder:product-2021
* folder:product-2021 is a parent of folder:product-2021Q1
* folder:product is a parent of folder:product-2021
Scenario: user:anne can read and write but not share folder:product-2021
Given user:anne is an owner of folder:product
When she accesses folder:product-2021
Then she has the following permissions
| can_view |
| can_write |
But she does not have the can_share permission
Scenario: user:bath can read but not write or share folder:product-2021
Given user:beth is a viewer of folder:product-2021
When she accesses folder:product-2021
Then she has the can_view permission
But she does not have the following permissions
| can_write |
| can_share |
Feature: Check IP based access
Background:
Given user:anne is a viewer of document:1 with non_expired_grant_and_valid_ip being
| grant_timestamp | 2023-05-03T21:25:20+00:00 |
| grant_duration | 10s |
| cidr | 192.168.0.0/24 |
Scenario: user:anne can access document:1
When context is
| current_timestamp | 2023-05-03T21:25:23+00:00 |
| user_ip | 192.168.0.0 |
Then user:anne has the viewer permission
Feature: List folder access
Background:
Given folder:5 is a parent of folder:product-2021
* folder:product-2021 is a parent of folder:product-2021Q1
* folder:product is a parent of folder:product-2021
* user:beth is a viewer of folder:product-2021
Scenario: user:anne document access
Given user:anne is an owner of folder:product
When she searches for folder
Then she has the can_view permission for
| folder:product |
| folder:product-2021 |
| folder:product-2021Q1 |
And she has the can_write permission for
| folder:product |
| folder:product-2021 |
| folder:product-2021Q1 |
And she has the can_share permission for
| folder:product |
Scenario: user:beth document access
When user:beth searches for folder
Then she has the can_view permission for
| folder:product-2021 |
| folder:product-2021Q1 |
And she has no can_write permission
And she has no can_share permission
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment