Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Authorization feature #316

Closed
tpow opened this issue Jul 6, 2020 · 10 comments
Closed

Authorization feature #316

tpow opened this issue Jul 6, 2020 · 10 comments

Comments

@tpow
Copy link
Contributor

tpow commented Jul 6, 2020

Masonite handles authentication nicely (user identification and log in), but needs a way to authorize access (permission to do something) and define roles. Rather than having apps build their own authorization layer, it would be nice if the framework provided a basis for it.

Ideally this would be middleware that handles database model and controller access as well as various helpers for checking if users can or can't do something.

As a scenario, once this is built it would be nice to expand Masonite's blog tutorial with the addition of several user roles such as Administrator (can do anything), Editor (can change other's posts, and potentially create new ones) and Writer (can only create and edit their own posts).

@girardinsamuel
Copy link
Contributor

Hi @tpow !

I agree that this would be a nice addition. I guess it should be in its own package.
@nioperas06 (and others maybe) created something that might be of interest
https://github.com/hellomasonite/permissionite

@nioperas06
Copy link
Contributor

Hi @girardinsamuel Yes, you're right. Putting these features in a separate package would be one of the best solutions. However, since Masonite is inspired by Laravel, it is interesting to look at features like Gates and Policies https://laravel.com/docs/7.x/authorization. hellomasonite/permissionite is on hold right now because we're waiting for the new ORM 🔥 .

@tpow
Copy link
Contributor Author

tpow commented Aug 3, 2020

I would want Authorization to be part of the framework, much like it is with Laravel. Any application that needs authentication will almost certainly need to deal with some form of authorization. Gates and Policies like Laravel seem a nice approach. Any reason that couldn't be adopted in Masonite?

@nioperas06 Are you just waiting on the new ORM because you know it will require code changes? Is permissionite capable right now with Masonite 2.3?

@nioperas06
Copy link
Contributor

Oh I think it could be adopted in Masonite. @josephmancuso has enough (new ORM and other tasks) to do right now to focus on it I guess. You can try to suggest something 👍

Not the only reason. We're focusing on the Masonite Forum right now and we'll be back to permissionite after that. That's why I put the repo to private now.

@girardinsamuel
Copy link
Contributor

Those concepts of Gates and Policies are really great ! (I am coming from a Django background and there is some tools but no created this way). @nioperas06 when you will start working on it again, notify me, I would be glad to help !

@AxDSan
Copy link

AxDSan commented Jul 22, 2021

What has been going on with this feature request? I would like to see a package with this, among other things, but everything seems to be so far away... now, I wanted to try out, Masonite, for its similarities with Laravel, but it's maturity tells me that it's a very very early into the game, my best bet would be to switch back to another framework, until its mature enough with all things I wanna try on.

Cheers!

@girardinsamuel
Copy link
Contributor

With Masonite 4 coming in the game there will be more features and we will start to develop Masonite ecosystem such as this one eventually !

@josephmancuso I don't know if you planned to work on this ! Else I can develop something similar to this. I am also thinking that this feature is quite important !

@josephmancuso
Copy link
Member

@josephmancuso I don't have anything planned for this but this is definitely a great idea for either a feature of a package

@girardinsamuel
Copy link
Contributor

I have started to work on this as a feature available in M4. I am trying to follow M4 philosophy and to use Gate and Policy concepts from Laravel.

Stay tuned 😉

@girardinsamuel girardinsamuel self-assigned this Jul 24, 2021
@josephmancuso
Copy link
Member

Gates and policies are added in M4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants