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).
Describe the feature
Currently, there is a
requires_customer_registration_completion
flag which indicates whether upon logging in auser
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 theRequiresCustomerRegistrationCompletion
permission to restrict customer-creation to those uses w/ the aforementioned flag set to True. But the latter uses theIsAdminOrManager
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).