Skip to content
Discussion options

You must be logged in to vote

Alright, in the meantin I've realized that I'm NOT supposed to separate user data on a collection level but on a doc level.
This is because you can only return query constraints (by access functions) on a doc level.

For the sake of completeness I document here what I did wrong:

I had a 'pages, 'media', etc collection for every user.
Within the collections I hard coded the access restrictions.

// my access function
function allowSpecificUsers({ req }, allowedUsers = []) {
	try {
		//...
		if (allowedUsers.includes(req?.user?.name)) {
			return true
		} else {
			console.log(`[access] requesting collection "${req?.collection?.config?.slug}" user NOT allowed: "${req?.user?.name}"`)
			return f…

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Comment options

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