astrosat / django-astrosat-users

Common backend library for Astrosat projects' user management
GNU General Public License v3.0
2 stars 0 forks source link

Add a single flag on a user to indicate to the front-end which stage of the sign-up process they are on. #102

Closed allynt closed 4 years ago

allynt commented 4 years ago

Describe the feature

Currently, there is a requires_customer_registration_completion flag which indicates whether upon logging in a user should be redirected to the create-customer-view. However, that view includes creating a customer and then a customer-user via the API. The former uses the RequiresCustomerRegistrationCompletion permission to restrict customer-creation to those uses w/ the aforementioned flag set to True. But the latter uses the IsAdminOrManager permission to restrict customer-user-creation to MANAGERS of customers. This leads to a Catch-22: how can the user be a manager of the customer before they have been added to said customer?

Additional context

Initially I thought about adding a second requires_customer_user_completion flag and permission to wrap the customer-user-creation view. But this could start to get unweildy.

Instead I plan to refactor the code to use a single flag: registration_status w/ values like "USER|CUSTOMER|CUSTOMER_USER|ORDER|NONE" and a permission class that takes one of these values.

The tricky bit will be dealing w/ "ORDER" (b/c that is a feature of orbis rather than django-astrosat-users).