User/group/role model question

Hi.

I have an app where “users” can belong in “groups” with certain “roles”
(eg. a user can own a group).

Normally I’d make users has_and_belongs_to_many groups and put a role_id
on the join table. But - a role is really a first class citizen also, so
a model is in order.

The problem with making a “role” model which has_many “users” and
“groups”, is that it blurs the user/group relation which is also a first
class citizen.

A concrete need is, that I need to be able to look up “items” which have
been assigned to a “user”, or a “group” in which the user has the role
owner.

How can I support this need and have a “role” model also?

Br,

Morten

Morten wrote:

I have an app where “users” can belong in “groups” with certain “roles”
(eg. a user can own a group).

How can I support this need and have a “role” model also?

I’d have a look on rbac standard and its rails implementation,
https://activerbac.turingstudio.com/trac

Jean-Christophe M. wrote:

I’d have a look on rbac standard and its rails implementation,
https://activerbac.turingstudio.com/trac

Thanks for the pointer. It looks like the features I need are in Rails
1.1 (“through” associations).

Br,

Morten

Just FYI,
I am doing exactly what you are trying to do with Edge rails but this
newest
release candidate is bombing for me for some reason. I opened a ticket
for
it, and will continue to look for a solution. It is entirely possible
that
it is a syntax error on my part,but it was working for me in the
previous
edge version of rails:

http://dev.rubyonrails.org/ticket/4376

Mark

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs