keithwhor / nodal

API Services Made Easy With Node.js

Home Page:http://www.nodaljs.com/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Nodal and route access levels

fabiomig opened this issue · comments

Hello guys!
@keithwhor congrats for this wonderful project!

Well, i want to know, what is the most efficient way to create role level & controller permissions

Imagine this route
/v1/foo

In this route i would like to:
Admin CRUD
Client only list

Is there any (or planned) generator for this?

Regards
Fábio

Closed this because I misunderstood what you were asking for.

My personal recommendation is to have v1/foo for your user / client level CRUD interface and v1/admin/foo for the admin controller, and then write Middleware to do authorization handling. I'll have to write documentation about this soon.

Right, but i think that both users could use the same controller for that.
What you see that could be a problem?

It's just expecting a single controller to do a lot of logic, and gets messy pretty easily. I would separate your concerns between controllers. I would recommend treating a controller as a service for a specific task, and admin tasks are distinctly different from user tasks. :)