In this lesson, we'll learn how we can specify user roles using a User and Role AdonisJS Model within our project. This serves as a follow-up to our earlier, viewer-requested, lesson on multi-model authentication to display how a single-model approach given a role is an easier authentication structure to work with.
👍 If You Enjoy This Video, Consider Hitting The Like Button!
🔓 Multi-Model Authentication lesson this is meant to follow up:
• How To Do Multi Model Authentication with ...
🥁 Subscribe To Stay Notified For New Lessons:
https://www.youtube.com/adocasts?sub_...
📕 View on Adocasts:
https://adocasts.com/lessons/adonisjs...
👨💻 Find The Code For This Lesson Here:
https://github.com/adocasts/user-role...
📚 Chapters:
00:00 - Introduction
00:43 - Creating & Configuring the Project
02:25 - Defining User Roles & Relationship
04:40 - Auth Controller
05:20 - Logout
05:58 - Register
07:52 - Login
09:00 - Registering Routes
09:30 - Authentication Forms
10:26 - Registering Middleware
11:00 - Testing Authentication
11:40 - Defining User Role Model Relationship
12:20 - Checking User Role
13:12 - Checking User Role Using Role Enum
14:04 - Adding IsAdmin Computed Property
14:52 - Wrapping Up
-----------------------------------------
🕸️ Website: https://adocasts.com
🐘 Mastodon: https://fosstodon.org/@adocasts
🐦 Twitter: / adocasts
👍 GitHub: https://github.com/adocasts