Forum: Ruby on Rails Admins and Customers vs. Users

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Fc6f5b908cfa12868292f985e0de2788?d=identicon&s=25 elle (Guest)
on 2009-03-24 23:32
(Received via mailing list)
Hello,

I wanted to ask how do most people approach this:
I have several staff that act as admins and have control of products,
customers, etc... I also have customers that can log in and change
their details, password, view previous orders, make new orders, etc...
Furthermore, each customer is assigned a discount level.

Now, I wanted to ask, would you normally separate them into two
separate objects (and two separate tables) or would you use just one
object 'Users' with a boolean defining whether they are admin or not?
Also, if Admins and Customers approach was selected, how would you
suggest implementing login?
Just trying to plan my application and how I should tackle this.

Cheers,
Elle
171ea139761951336b844e708d1547ab?d=identicon&s=25 James Byrne (byrnejb)
on 2009-03-24 23:53
elle wrote:
> Hello,
>
> I wanted to ask how do most people approach this:
> I have several staff that act as admins and have control of products,
> customers, etc... I also have customers that can log in and change
> their details, password, view previous orders, make new orders, etc...
> Furthermore, each customer is assigned a discount level.
>
> Now, I wanted to ask, would you normally separate them into two
> separate objects (and two separate tables) or would you use just one
> object 'Users' with a boolean defining whether they are admin or not?
> Also, if Admins and Customers approach was selected, how would you
> suggest implementing login?
> Just trying to plan my application and how I should tackle this.
>

I think that you might find it profitable to read up on Authorization
and Rails.  You can start with these if google does not help:

http://www.binarylogic.com/2008/11/3/tutorial-auth...
http://code.google.com/p/rails-authorization-plugin/
0fc8cdefe9375828e65e650b73887ac1?d=identicon&s=25 Simone R. (athlon)
on 2009-03-24 23:55
elle wrote:
> Hello,
>
> I wanted to ask how do most people approach this:
> I have several staff that act as admins and have control of products,
> customers, etc... I also have customers that can log in and change
> their details, password, view previous orders, make new orders, etc...
> Furthermore, each customer is assigned a discount level.
>
> Now, I wanted to ask, would you normally separate them into two
> separate objects (and two separate tables) or would you use just one
> object 'Users' with a boolean defining whether they are admin or not?
> Also, if Admins and Customers approach was selected, how would you
> suggest implementing login?
> Just trying to plan my application and how I should tackle this.
>
> Cheers,
> Elle

A boolean can be a limit , use an integer so later you can define
something in the middle (like a tutor , helpdesk user, helpdesk manager,
partner )



If you need some more flexible you can use 3 table ,
User , Group and Role

Maybe this can give you some hint
http://docs.liferay.com/portal/4.2/official/lifera...
Fc6f5b908cfa12868292f985e0de2788?d=identicon&s=25 elle (Guest)
on 2009-03-25 04:36
(Received via mailing list)
I was thinking about using Authlogic -- but that wasn't my question.

My logic tells me to create admins and customers instead of just users
-- just wanted to check what others usually do.



On Mar 25, 9:53 am, James Byrne <rails-mailing-l...@andreas-s.net>
Fc6f5b908cfa12868292f985e0de2788?d=identicon&s=25 elle (Guest)
on 2009-03-25 04:37
(Received via mailing list)
Haven't thought of it like that. Going to read the link now.



On Mar 25, 9:55 am, "Simone R." <rails-mailing-l...@andreas-s.net>
This topic is locked and can not be replied to.