How to create a admin user in Phoenix

I’m working on small project for my customer. My customer wants to edit contents in website periodically(something like changing header text and description etc). So I think thesis-phoenix is perfect fit for this project and I really want to try out.

Here are things I want to do

  1. I want to make one admin user or more.
  2. And Admin user can only do edit contents using thesis-phoenix.
  3. Website doesn’t need a authentication for visitors.

I was a django user and there is a command like “python manage.py createsuperser” in framework to create a superuser.
So admin can do admin things.

In this project, I already implemented simple authentication system using Comeonin lib, then how can I do “admin” things?
I looked up canary and Canada can, but it looks like those project is overkill for this project.

Any recommendation , solution, advice please?

Thanks!

You need a role field in the users table and some simple module to check if the currently logged in user has that role or not. You call the authorization module in the controller files just before executing the to be protected actions.

I recommend having a look at this:

3 Likes