0

So from not using any framework at all, I finally forced myself to use LARAVEL 5.2 because i got tired of re-writing my own "framework" over and over again.

Anyway!

I think I'm pretty familiar with the Laravel framework and its dependencies now.

But now I need guidance on how to do this the smartest way.

I want to create a Middleware based on the companys DC.

Now every user is AUTHED by php's envget("username"); with a re-written "auth" middleware. So far, so good. (The server is not in the DMZ btw).

The thing is, our team thought that we should populate a database-table with all the users and give them a "Privilege-level", lets say 1 through 3 where 1 is "read only", 2 is "read+modify" and 3 is "read+create+modify" with our restful controllers. But.

since we use restful controllers i cannot really give them individual Middlewares? do I manually have to change every RESTful resource in my routes.php to make this happend? or can i do this another way? I would like to keep it as simple as possible.

Any suggestions?

Thanks in advance (reserved for typsos )

naT erraT
  • 502
  • 1
  • 5
  • 19
  • your information are not enough to understand your question, can you elaborate it little more? give some code or visual example to understand your question – Qazi Mar 22 '16 at 03:38

1 Answers1

1

@Tarre Tan You can achieve this by adding your middleware in a parent controller's constructor. All your controllers that require permissions will inherit from that controller. You have one place to adjust your permissions if you want. Hope this helps

Koudjo
  • 26
  • 1