So let's continue with the authorization.
Okay.
So what modifies Don Boudreaux over here?
Let's say he will console.log.
With undefined.
Okay.
And if you if we boost the row but will not provide anything, let's say.
It will return empty array.
Right now we need to check a little bit if required.
Row.
Known as it.
It means we will allow perform the action because we don't require anything.
Right.
So for that reason we will return true over here.
Okay.
And we need to check one more thing if required.
Road length.
Equals zero.
We need to return.
True.
Also.
Let me pass this thing with a row as rows.
All right.
Okay.
We need to check that if we don't provide anything.
Okay.
Or we provide it with empty, it means we will allow any user can perform this action right now, the
first thing I want to check.
And we need to check if required.
Row.
Right here.
If skin.
Close the Acme.
Okay.
And the current users.
Let me create the current user.
And if the current user is Acme.
Sorry, you got it wrong.
Is Acme.
Right here.
We will allow.
Allow us.
Right.
If it's at a require right?
We have the admin and the current user.
We also admin.
We will allow it to perform the action.
And we do just one more thing if required include if we include the user and the current user.
A also the user.
We will allow plurals, but we will not allow this because we want only the user has its own resource
can be.
Retrieved.
Right.
And with a little bit more than that in here we need to check the current user.
Right here.
Okay.
For User ID.
Current user dot underscore ID and resource ID.
Okay.
We will request.param.id okay.
For example inside here in order to update.
The user.
Right here it needs to pass the user ID right.
So for example here we will retrieve the id based on the param.
We need to check if the user id.
Is the same with id we will return true okay.
If not, we will grow new.
Forbidden.
Exception.
We always, um.
You know.
Do not.
Uh.
You cannot perform this action.
Okay, I will scroll across.
And if not, if it doesn't accept anything is, uh, any block right here, it will throw the error
with the.
Same message right here.
Okay.
Actually, you can change the message right here a little bit.
Let me say.
So All about the video.
I already changed the message a little bit.
Right here.
In better way.
You can only access your own resource and you do not have enough medicine in here.
It's much more better.
And let's see how it works.
For now, for the more inside.
I mean, if I perform the action, we will get an error, right?
You do not have enough.
But this one.
Very cool.
Right?
Right here I will duplicate with.
Right.
My users.
Okay.
For example, right here.
Let me open the database.
Right now I will sign in with the account right here.
Okay.
And if I find the another account, let's say.
Now you can only access your own resource.
Right now, if I copy the own resource, I will say.
Now you can say it already successfully.
Right.
That is how we can perform the authorization in this case.
Okay.
With the reflect tennis.
And golf.
So I hope you understand this video.
I will see you in the next one.