Hi, everyone.
I’m working on a project that, when i make the pool request to the GIT repository is immediately deployed on Vercel. Accordingly I have a script which on admin key before deployment updates graphQL scheme, creates functions, indexes (if not exists). But how do I update array of privileges in user-definition roles from this script? (if role already exist).
For example im added new collection and i want set new privilegies for this collection? And whether the best practitioners will delete roles and re-create?
Example function create role:
.query(
q.CreateRole({
name: 'free_user',
privileges: [
{
resource: q.Collection('User'),
actions: {
read: q.Query(
q.Lambda('userRef', q.Equals(q.Identity(), q.Var('userRef'))),
),
write: q.Query(
q.Lambda(
['_', 'newData', 'userRef'],
q.And(
q.Equals(q.Identity(), q.Var('userRef')),
q.Equals(
'FREE_USER',
q.Select(['data', 'role'], q.Var('newData')),
),
),
),
),
},
},
{
//Here i want new object privilege for other collection
}
]