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

Optional --auth flag on canvas:install #939

Open
prestontoor opened this issue Feb 17, 2021 · 6 comments
Open

Optional --auth flag on canvas:install #939

prestontoor opened this issue Feb 17, 2021 · 6 comments
Labels
enhancement New feature or request

Comments

@prestontoor
Copy link

I use Laravel's auth system via Fortify to set up users with dashboard features. However, when they want to write a blog, they go to Canvas and login again which gets stored in the DB as a different username/password.

This is really clunky. Is there any way to allow canvas to link into Laravel's existing user platform or must there be a user profile/db for Laravel features and a user profile/db for blogging in Canvas?

@austintoddj
Copy link
Owner

Canvas used to use Laravel's auth system. It worked fine, except for the fact that things become really tied to the base Laravel user model at that point. If you use Laravel's system, and a developer assigns the PK on the user model to be userID instead of the default id, things break.

I agree that it's an extra step, but breaking things out like this allows the package to cater to a number of different users with various setups.

If you think of a solution that can cater to the 80/20, I'd love to hear it and perhaps work on getting it implemented. I'm intent on making the package better, and it's questions like this that push it ahead.

@austintoddj austintoddj added the question General question or concern label Feb 17, 2021
@prestontoor
Copy link
Author

I'm very thankful for what you've made in Canvas. It's a great blogging system!

In regards to your answer, what about giving the option to use either the Laravel user authentication or use Canvas'? Perhaps two different repos or branches depending on how they're going to use it.

I think your blogging platform is great and would even pay a small one-time fee per project if it had the ability to work the way I described above.

@austintoddj
Copy link
Owner

That's highly encouraging, and I appreciate it.

Really interesting thought, similar to how Laravel Breeze or Jetstream allows optional flags like:

jetstream:install livewire
jetstream:install livewire --teams
jetstream:install inertia

Canvas might be able to adopt something like:

canvas:install --auth

I'll go ahead and mark this as an enhancement and see what I can do about coming up with a proof of concept for it.

@austintoddj austintoddj added enhancement New feature or request and removed question General question or concern labels Feb 17, 2021
@austintoddj austintoddj changed the title Use Laravel's Auth Rather Than Canvas' Optional --auth flag on canvas:install Feb 17, 2021
@ReeceM
Copy link

ReeceM commented Feb 17, 2021

Canvas used to use Laravel's auth system. It worked fine, except for the fact that things become really tied to the base Laravel user model at that point. If you use Laravel's system, and a developer assigns the PK on the user model to be userID instead of the default id, things break.

I agree that it's an extra step, but breaking things out like this allows the package to cater to a number of different users with various setups.

If you think of a solution that can cater to the 80/20, I'd love to hear it and perhaps work on getting it implemented. I'm intent on making the package better, and it's questions like this that push it ahead.

I know I used to use the Laravel auth system to link back to a separate app for users to log in with before the update. Admittedly was a bit confused at first :D. But figured it out.

Would there not a be a way to make it work similar to the Laravel auth system where you could redefine or extend the authentication system?

Similar to how you can add custom auth parts by overriding the interface's ?

So you could have a AuthProvider type of interface and define that in a Service Provider class, then you can define a new one that implements the concrete classes and methods as a user, maybe changing the Model to use.

You could then delegate where Canvas is checking for log in credentials, yet when not overridden can default to the original structure. That would probably make it not break for current users, and not noticeable for new users.

Below Added after above reply (#939 (comment))

I think the --auth part sounds practical, as that would allow you to have a set of stubs laid out and change it in a config section maybe.

You could maybe make an exportable migration for instance to create a table to hold roles for a user (and preferences), but could be edited if it doesn't fit the user's preferences. While not holding email information and such.

It could retain a foreign user_id could be string or BigInt. But then if the contract/interface style isn't used the user could define the primary linking key that links to roles and profile information and preferences.

The above is only stated based on the fact I dug through the code to figure out what was happening and saw how it worked to learn the auth system was different. Also knew some of the inner workings of the old one as I had extended the models and changed some features and table styles :)

@moseskamau338
Copy link

any progress on this?

@austintoddj
Copy link
Owner

@moseskamau338 No progress on this yet (just got back from a family vacation)

I'm still hashing out what this looks like functionally in the app. There's a discussion here that would be a perfect spot to drop any thoughts or ideas.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants