Skip to content

Instantly share code, notes, and snippets.

@mustafa-qamaruddin
Last active April 10, 2022 14:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mustafa-qamaruddin/95891773274503137959a9f20e338a2c to your computer and use it in GitHub Desktop.
Save mustafa-qamaruddin/95891773274503137959a9f20e338a2c to your computer and use it in GitHub Desktop.
test case with access rights
# run a find on pair
# add a pair
mutation upsert($values:HypiUpsertInputUnion!) {
upsert(values:$values){
id
}
}
{
"values": {
"Pair": {
"hypi": {
"id": "p.101"
},
"key": "k",
"value": "v"
}
}
}
# add a user
mutation createAccount($value:AccountInput!) {
createAccount(value:$value)
{
id
instanceId
}
}
{
"value": {
"hypi": {
"id": "u.101"
},
"username": "test101",
"emails": {"value": "test101@crlog.io"},
"password": {
"value": "1234567890"
}
}
}
# give him access to resource
mutation upsert($values:HypiUpsertInputUnion!) {
upsert(values:$values){
id
instanceId
}
}
# run a find on pair
# give hime another access to same resource
mutation upsert($values:HypiUpsertInputUnion!) {
upsert(values:$values){
id
instanceId
}
}
{
"values": {
"AccessRight": {
"resource": "p.101",
"resourceType": "Pair",
"operationType": "Query",
"operation": "get",
"permissionType": "RBP",
"approved": true,
"members": [
{
"hypi": {
"id": "01FW5RZHJRYJCCNQ560627CRK4"
}
}
]
}
}
}
# login the user
{
login(
username: "cameron",
password: "1234567890"
) {
sessionToken
}
}
# run a find on pair
{
find(type: Account, arcql: "*") {
edges {
node {
... on Pair {
hypi {
id
instanceId
}
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment