0

I'm building a website, where vendors can have their own separate website on. There is vendors and normal users.

The goal is to have a closed profile page w. login for both, where a vendor can edit his website, check out stats and more. A normal user is also able to login to mark different vendor's websites as favourites and check out newest post on the forum. So what is important here is: They booth need to be on my Discourse forum, but I'd like to avoid a Vendor to have a login both for vendor and for a user (Signing up twice).

http://www.discourse.org/ has SSO ability for devise, but im not sure if it allows for two different devise models.

Should I:

Create one devise-model for both, called Users? (And have a boolean or integer if User is a vendor/has vendor-access?)

Or:

Separate them: One for Users and one for Vendors?

I haven't tested out if Discourse allows for two devise-models, since Discourse is the easiest to set up in production-mode. But I need your advice: Can I use Single sign-on for devise with two different devise models? Is it the preferable way? Or is there other ways than this I haven't noticed? Like adding a user to a vendor, or something?

Using rails 5

sneglefar
  • 117
  • 9

1 Answers1

0

We can achieve this by managing role field. We can make entry on the time of sign_up in role field that user is normal user or vendor. After create this we check user_role can in after_sign_up_path and redirect to path accordingly. for this refer gem rolify please correct me if getting any thing wrong.

Atul Shukla
  • 171
  • 1
  • 8
  • My initial thought too. Since this is potentially a pretty big site, I'm thinking of using Pundit for roles? Would like to hear some other people's suggestions before accepting an answer – sneglefar Dec 02 '16 at 10:21
  • What if sign_up accepts different parameters for users and vendors? – Anas Ansari Aug 06 '22 at 23:59