forked from sourcenetwork/defradb
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
…#3108) ## Relevant issue(s) Resolves sourcenetwork#2992 ## Description An actor granted a write permission still couldn't write unless also given `read` permission Example Policy where reader can strictly only read and writer can strictly only write: ```yaml name: Test Policy description: A Policy actor: name: actor resources: users: permissions: read: expr: owner + reader write: expr: owner + writer relations: owner: types: - actor reader: types: - actor writer: types: - actor ``` Then the policy above (assume `XYZ` is resulting `policyID`) is linked in a schema that is loaded: ```gql type Users @Policy(id: XYZ, resource: "users") { name: String age: Int } ``` Now if the `owner` (index `1`) makes a relationship giving `write` access to the `second` actor (index `2`) in our testing frame work like syntax: ```go testUtils.AddDocActorRelationship{ DocID: 0, RequestorIdentity: 1, TargetIdentity: 2, Relation: "writer", } ``` The identity `2` still could not mutate due to lack of read permission. ```go testUtils.UpdateDoc{ Identity: immutable.Some(2), // This identity can still not update. DocID: 0, Doc: ` { "name": "Shahzad Lone" } `, ExpectedError: "document not found or not authorized to access", } ``` Some existing tests that documented this have now been updated with the new behavior: - `TestACP_OwnerGivesUpdateWriteAccessToAnotherActorWithoutExplicitReadPerm_OtherActorCantUpdate` -> `TestACP_OwnerGivesUpdateWriteAccessToAnotherActorWithoutExplicitReadPerm_OtherActorCanUpdate` ## How has this been tested? - CI & Fixed the asserted test that documented this behavior
- Loading branch information
1 parent
655e1a4
commit bc68f57
Showing
6 changed files
with
159 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters