Skip to content

How to provide read only access #5872

Closed Answered by haikyuu
arunaruljothi asked this question in Q&A
Discussion options

You must be logged in to vote

You can use access policies for this use case.

global current_user: uuid;

type User {
  required email: str { constraint exclusive; };
  role: str;
}

type BlogPost {
  required title: str;
  required author: User;

  access policy author_has_full_access
    allow all
    using (global current_user ?= .author.id);
  access policy other_teams_can_read
    allow select
    using (global current_user.role = 'read-only');
}

And then the other part is to authenticate other team members so that they have the adequate user type that can only read.

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by arunaruljothi
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants