The idea is :
If mike have an account and took the url of this item in the picture (this item _owner is mike)
And send it to another user called carl , carl will be able to see the content of this item .
This is the problem I have I want to make a security wall to check if the user is the owner of this item or not , if he is the owner show content and if it is not re direct the user to the homepage.
but I want to do it in a professional way with router or hooks
can you help me because I tried to read about it but I did not understand any thing and nothing work for me
this is my failed try with router :
import { forbidden, next, ok } from 'wix-router';
export function patient_afterRouter(request, response) {
if (response.data._owner === request.user._id) {
return next();
}
return forbidden();
//TODO: write your code here...
}
i am struggling with this for many days and read all docs about router and hooks , any help ?
you did it
you just made my day , thank you much finally solve this problem
i did not think about this query at all i do not know why .
thank you again❤️
Querying or filtering collection with 5k records will take more time (but I can’t say how significant it’s going to be. You’ll have to test it).
There’s a way to make it faster by creating an index. But this feature is in beta phase and not available to all users (I think it’s available to users in the UK).
See: