Role
Defines a user's permissions.
We'll store the possible roles for a user in an enum. So first, create the file auth/roles/enums/role.enum with following content.
Now, let's go back to the User
entity and declare a role
for it. This is how we can map an enum to the database. Also notice the default
value.
Now, generate and run the migration add-role-to-user. Existing users will receive the USER
role.
Commit - Creating role enum
Last updated