Hi everyone.
In this video, let's add the authorization for the command controller.
Okay.
Right here.
After with authentication, we will put the raw raw over here.
And with the create file on get.
And here we don't list okay.
We don't need any authorization because everyone only need to authentication can be performed this action
right.
But without that I want to add a row.
The rows will be admin and user okay.
The admin can update every command and user can update each on command.
Right.
And here will be also.
And same Think we already used that.
Make sure we update the resource service.
Okay.
Right now let me inject the command.
Command model.
And it will error.
Right.
Over the module we import.
Command.
In command schema.
Okay.
That is an insight here.
Command is not defined.
Let me click over here.
Somewhere.
Oh let me import module.
We import correctly.
Okay.
After that we to create another case will be for command.
Restore ID.
From file.
And right here we will return the ID right command dot.
Now if you look at the command.
Schema you will say we have a user command field okay.
We will rely on that field dot underscore ID string.
That is Okay.
We just need to modify the resource service.
And let's take this.
Right here.
Uh, for example, right now I will go and I will sign in with the different account.
And I will copy the access token.
Right.
And I will try to delete uh I will try to get command first.
I'm going to command and I will delete.
Okay.
With the list I will copy the access token over here.
And run here.
Delete.
And in here let me try to release this thing.
Try to release the command over here.
Let's see.
Okay.
You only can access your own resource.
Okay.
Very, very good.
Right.
And I'm sure it will work without that.
Right.
Now, let me try to create a new command with the current users.
Access token.
Both the here and create a command.
Right.
Create a command.
Say okay.
After here.
Let me try to delete it.
It work.
It mean we already got right.
Okay.
It already remove correctly.
So that.
Is that about the authorization.
And it very easy since we already set up everything at the beginning right.
So I hope you enjoyed.
Right now I will see you in the.