Github style organizations

17 views
Skip to first unread message

Alec Koumjian

unread,
Mar 18, 2014, 7:50:53 PM3/18/14
to django-...@googlegroups.com
Hey folks,

I'm knocking around a few ideas in my head and would like your input. Right now I have a webapp where users have various types of assets and resources (Videos, Collections, Direct Sales). We want to create a system where multiple users can be sharing the above mentioned resources.

I really like how github lets users become part of organizations, can switch context between their main account and organizations they are a part of. I want to implement this, somehow.

Since the above resources already point to a User object for write/read permissions, and request based filtering, I'm thinking that each organization will exist as a separate User in the database.

My current thought is to find a way to "toggle sessions" on the client side, so when a request is made, Django will treat the request as coming from the organization "User". Not sure how I would handle a user having different levels of permissions for an organization.

Maybe a custom middleware that places both the "real" user and the "acting" user on the request object?

Brent O'Connor

unread,
Mar 19, 2014, 9:39:57 AM3/19/14
to django-...@googlegroups.com
Maybe I’m not fully understanding what you’re doing, but having non-human users as a group, doesn’t sound like an ideal solution. Have you looked into using something like https://github.com/lukaszb/django-guardian for a per object permission system?

As far as your sessions go … I would probably just have an active_group session variable and then add the logic for selection objects into the each Model’s manager (e.g. if active_group: select thing by group else select thing by user).

-- 
Brent O'Connor

--
You received this message because you are subscribed to the Google Groups "django-seattle" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-seattl...@googlegroups.com.
To post to this group, send email to django-...@googlegroups.com.
Visit this group at http://groups.google.com/group/django-seattle.
For more options, visit https://groups.google.com/d/optout.

Alec Koumjian

unread,
Mar 19, 2014, 10:53:38 AM3/19/14
to django-...@googlegroups.com
So the reason I want organizations represented as users is that they will share many of the properties of users. They will need profiles, using our same user profile model. They will own sets of video assets, collections, direct sales, transfers, etc. 

We started with a per object permission system (guardian) and found it to be slow and brittle. 

I have yet to set session variables, so I'll look into that. We will probably need to add the check somewhere in our tastypie resources.

Bradley Young

unread,
Mar 19, 2014, 11:26:05 AM3/19/14
to django-...@googlegroups.com
Alec,

Maybe you could start from something like django-impersonate?

Bradley

Alec Koumjian

unread,
Mar 19, 2014, 11:31:36 AM3/19/14
to django-...@googlegroups.com
An interesting suggestion. Not looking like a great fit so far, but cool that it exists.
Reply all
Reply to author
Forward
0 new messages