I've got a general architecture question. Let me first setup the scene:

I have devices which report back data from the field. Each device has its own device_id.
I have groups of users who maintain different groups of devices. I'm told that users will never share data between devices. (riiiight)

I first setup a site where users were grouped into "roles" and then used CCK to create devices and assign "roles" to devices. Its working pretty well - however ... as the number of roles got larger than 4, it makes user administration messy. Really its more like 3 types of users (roles) with the third role having different "ownership" of devices. Plus the way I have it now, it makes the permissions page gets messy with all the roles spaced out on it out to the right. So now I'm rethinking how to link groups of users to data coming in from the devices.

Right now I'm thinking of creating a CCK/content_type and assigning nodes created of that type two properties
a) device_id
and
b) X where X would be whatever thing would map back to a user.

I can think of two ways to setup X off the top of my head
1) Taxonomy; Assign a term to a user's devices and the same term to a user. All users with the same taxonomy are grouped. Devices are given a device_id and a taxonomy and we have a mapping between uid <-> taxonomy <-> device <-> device_id
2) Profiles: Create a profile item and assign that item to a device. All users with the same profile term are grouped. We have a mapping uid <-> profile_item <-> device <-> device_id

But I'm wondering if that really is a best way to do it or if perhaps I'm missing something.

Thanks in advance.

Rar

Comments

dman’s picture

It would probably help imagining things if you described a little bit more about the actual domain of the problem. This is quite abstract. But if you can't, I understand.

I tried to picture the relationship, and it's tricky.
But.
You accidentally mentioned 'groups' a few times.
So how about Organic groups? That subdivides 'roles' into roles-per-group.
It works a bit like your proposed user - taxonomy - node(device) relationship you need, with the bonus of lots of extras, and even different roles (read-only, administer) on a per-group basis.

So your devices are (nodes that are) tagged as being in a 'group' .
Users are members of a group.
Users in a group have access to nodes in that group.

You'll get many-many relationships on both sides (if needed) and moving users and devices between groups will be pretty easy to manage.

When you find yourself creating special-case 'roles' to deal with parallel tasks, it's probably time to look at 'groups'.

rar’s picture

I've not used Organic groups before - my mention of groups was just my own mental construct and not referring to a module. I can install it and give it a go.