Hi everyone.
If you remember, is the boss is at the post office.
We have a file on method and what I want to do right now.
I want it will handle the privacy.
Okay.
We haven't handle that yet.
Right.
So in this video, let's step by step and do that.
If you remember inside the box what we have, we have some privacy okay.
With the public private and friends okay.
And by default it will be public.
So in this video I will write a little bit of code to.
Handle the privacy okay.
Inside the very object right here I will put um.
I removed our operator.
And right here I will handle privacy for library public.
Alright, here, we should wrap it inside the object.
Okay.
I feel like we need to handle workplace privacy, but place the variable here will be become true and
it will handle everything.
Okay.
And the next one will be privacy.
Friends.
Okay, I will show you table correct.
Friends.
Okay.
And with the friend we want to handle.
Something.
Let me take a look at the box schema.
We have of course in the author we have a user document.
And inside the user we have a friends Times.
All right.
Over here.
So right here I will put across and I will use the in operator with frame in this list over here.
And I will create the frame list normally and right here if the privacy.
Here are private and we should handle the authors, we will call the user.
ID okay.
Like that.
And let me explain for you what actually happened in the safari right here.
This is the Or operator.
It will match only one case okay.
If this is a public okay this will be true.
And the query we will find on add user.
But if it is the frame we need to filter by the author ID to the frame of authors.
Let me show you what exactly that means.
We need to find the frame of the authors.
Okay, that is me.
And if privacy will be private, we only allow the author can see that spot, right?
So only hover can say dashboard.
And let me find the frame IDs.
Let me try that.
In order to do that, we should inject the user submit.
Okay.
If you remember inside the user submit over here we have.
The file.
File one method over here right.
We can inject and re-use this thing.
Let me show you.
Insert the post module.
We should import the user module.
Insert the video here.
I will private user save it.
And from users of width right here.
I will call.
User.
Why this dot user dot file one with the current user underscore array dot okay.
And right here we need to call the frame friends of context.
Like this.
Okay let me call for an outhouse.
And over here I'm going to use a dot frames.
Okay.
Dot map V is for my frame dot a dot two string okay I will return the ID and we will move over here.
Okay.
That is let me take this further.
You can try to click on the user.
You will say we have a two account uh, from uh.
My mistake.
I already removed the Tomas.
Okay.
That's my mistake.
I don't know why I remove that.
Maybe I test something and I already removed us, and I don't know.
So, uh, right now we only have a zone, and, uh, over here.
Okay.
so this will be the frame.
Okay.
Let me rename it a little bit for easier to to understand.
I will call this guy will be uh.
Maria okay.
And the name will be Maria okay.
Right now the zone and Maria is offering.
Right.
So for that reason, we can, um, we can easily say that.
Let me go back and I will sign in with the zone account.
I will copy this thing, and I will, um, I will create a boss.
Okay, I will create a boss.
I will call new boss for friends.
And right here, what I will say will be friends.
And I will click on authentication and copy the token from zone.
Okay.
It means the author will be zone, right?
We already got a boss over here.
And when I click on Get Own boss, I will sign with my account to say.
Over here and said.
Now I already said privacy will be friend and the own public over here.
Very cool.
Right?
But right now, what happens if I create another account?
I will create a new account.
Maybe it will be Thomas right now.
And Thomas, I will say.
And I will go with the access token and I will click on get on post.
And I say, now you can say you you only can say the privacy will be public.
Okay.
You cannot say privacy will be friend right now.
So it means we are correct, right?
And let me handle the private case.
Okay.
I will say in which the zone account again.
And create the post.
And right here I will call in the privacy.
Of.
This sea.
Of privacy.
Boss.
Let me say.
Uh oh.
Sorry.
This is private.
Private.
Boss.
Let me say.
Okay.
We already got, uh.
The privacy will be private.
And if we get on with.
This, is the Thomas account, right?
We for sure will.
Don't say.
And let me sign in with the friend.
Account will be Maria and I will.
Don't see also.
Right.
Because this is private, only the author can say.
Let me say okay.
We only see the frame over here.
And right now, let me sign in with the author.
Account will be resolved.
So right now we already see this is the private.
Right.
But could it mean we already handled correctly for the file own method.
And now let's apply the curl for file one method okay.
You can do that.
But, uh I think this doesn't really matter with file method right now.
The best way is for the file own.
But if you want to apply feel free to do that.
Okay.
That is for that or for the job of this thing.
And I will see you in the next one.