inputlogic / django-api-starter

Boilerplate for starting Django DRF / API projects
2 stars 0 forks source link

Add organizations #74

Open adriaanwm opened 4 years ago

adriaanwm commented 4 years ago

It's so common for us to have organizations in apps it would be very useful to have the basics here. Would be helpful in apps like Yardstick, Moonroof, Disco, Floorspace, Purposely, etc. Some potential things to include:

staydecent commented 4 years ago

I think billing could be a separate app. We should be able to migrate the billing app from Cowork.

For groups/roles, there is a lot of existing work in django-land, and it will likely be better to use a well-supported library than to go from scratch.

I'll compile a few options and we can see if they would meet the requirements you and Wes have in mind.

staydecent commented 4 years ago

Looks like this would be the best option for building upon:

https://github.com/dfunckt/django-rules#permissions-in-django-rest-framework

Super flexible, easy to integrate with DRF etc. Rather then defining it's own model and database data, it's instead just custom callables that we define.

So, we could define a user_role ChoiceField on User and use that to define permissions, or we could create a Group/Permission/Role models and use those in our predicates. Totally open.

If you (@adriaanwm, @weslord) could provide some use-cases from those projects, then we can develop the lowest-common-denominator as a starting place.

adriaanwm commented 4 years ago

@staydecent For me one of the useful things would be an Organization app with Organization and Member models, with member roles (billing, owner, etc.) and basic endpoints for this + some integration with billing. I'm not really talking about django-level group/role permissions. A user could be a member of multiple organizations and have a different role at each of them. Think how many apps and services we use where Input Logic is an organization, and each client is also a separate organization, which we often want to also be a member of, and potentially transfer things between the different organizations. (Eg. sendgrid, heroku, moonroof, yardstick, aws, and almost any other service we use)

staydecent commented 4 years ago

@adriaanwm Yeah, we could use this on Yardstick actually....