Open theodorDiaconu opened 3 years ago
API Proposal:
security: {
roles: {},
'user': true | false | {} | collection.security.isolated("companyId", "companyId"),
collection.security.tenant("companyId"),
'anonymous': {
maxLimit: 100,
maxDepth: 5,
findOne: true | { filters, intersect },
find: true | { filters, intersect },
edit: true | { filters, fields: [], inside: "userId" },
create: true | { own: "userId", fields }
delete: true | { own: "userId", filters, "identity": "user._id" }
}
},
fields: [
field({
// Should we define field-level security logic? Wouldn't it be too much repetition and ugly blueprints?
})
]
shield.base.ts which is re-exported inside shield.base {}
// roles imported
export const shield: ShieldConfig<Post> = {
roles: {
}
}
shield(config, { resolvers });
Security options with basic option in blueprint, roles, security owner, etc. Keep it in "Collection.security.ts" (overridable) inside the resolvers for GraphQL.
Some thoughts for a primitive API: