nadineproject / nadine

Open Coworking Software
http://nadineproject.org
GNU Affero General Public License v3.0
163 stars 78 forks source link

[Question/Documentation] Examplary Resources / Subscriptions #450

Closed Noirde closed 2 years ago

Noirde commented 3 years ago

Unfortunately, I wasn't able to get it running via docker.

I'm currently still trying to understand the whole object flow and hoped maybe can give me some insights. Shouldn't be too hard in case somebody has a running version šŸ˜„.

As far as I understood it a user is always coming from the LDAP. At least there's no model for a user so it's coming from somewhere else. A user can be part of an organization but doesn't have to.

In order to consume something, a user must have an active membership with the corresponding allowances. A membership can be attached to one organization, and consumed by members of that organization. Alternatively a user can have a membership on his own name.

What I didn't understand based on the model (sorry for my lack of python knowledge) is the difference between the membership package and the resourceSubscription. On the member there's a code that somehow seems to rely the resourceSubscription to a package. Why isn't the package name the name of the membership package?

def package_name(self, target_date=None, include_future=False): ''' Determine the package name from the active ResourceSubscriptions ''' packaged_subscriptions = self.active_subscriptions(target_date).filter(package_name__isnull=False) if packaged_subscriptions: return packaged_subscriptions.first().package_name

The resourceSubscription has no relationship to membership package or subscription default (as it seems).

Would be happy if somebody could quickly explain the relationship of the objects (guess a quick diagram would work wonders).

jsayles commented 3 years ago

Happy to explain the model. Key here is that a "membership" is really just a collection of resource subscriptions. Think of MembershipPackage as a recipe not a membership. It does this with the SubscriptionDefaults. So if you have a membership type of "Part-Time 10" that comes with 10 drop-in days, 100 meeting room hours, and a mailbox, you would compile these into a MembershipPackage. Then when a member signed up you select that package and it creates the corresponding ResourceSubscriptions specific to that User and the specified timeframe.

User data is stored in the Django User. LDAP is an add-on and not required. I never ended up using it in production anywhere but I know a space in France is working on it.