Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

User creation raises AttributeError when app's default account store is an Organization. #88

Open
rbwinslow opened this issue Jan 25, 2017 · 0 comments

Comments

@rbwinslow
Copy link

The get_default_is_active function is invoked at multiple points during user model instantiation, due to its use in field definitions and synchronization with Stormpath accounts. In its access of the underlying Stormpath Python SDK's application object and connected resources, this function assumes that the application's default account store is a Directory:

directory = APPLICATION.default_account_store_mapping.account_store
verif_email = directory.account_creation_policy.verification_email_status

If, however, one has mapped the default account store for one's application to an Organization instead of a Directory in one's Stormpath dashboard, the resource object assigned to the directory variable will actually be an instance of the Organization class. Unlike the Directory class, instances of Organization lack an account_creation_policy attribute, leading to the aforementioned AttributeError: "Organization has no attribute 'account_creation_policy'"

I have tried a few different approaches to user model object creation, including get_user_model().objects.create(…) and get_user_model()(is_active=True) (since the definition of the is_active field is one of the places where get_default_is_active is called). All such user model instantiation ends in the same place: AttributeError.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant