In OrganizationBase, the add_user function has this signature: def add_user(self, user, **kwargs) and creates a new OrganizationUser with the kwargs:
org_user = self._org_user_model.objects.create(
user=user, organization=self, **kwargs
)
However, in AbstractOrganization, the add_user function has this signature: def add_user(self, user, is_admin=False) and creates a new OrganizationUser with:
org_user = self._org_user_model.objects.create(
user=user, organization=self, is_admin=is_admin
)
And finally, also in AbstractOrganization, there is a get_or_add_user function with this signature: def get_or_add_user(self, user, **kwargs), except it only checks for is_admin in kwargs, ignoring anything else creating a new OrganizationUser with:
org_user, created = self._org_user_model.objects.get_or_create(
organization=self, user=user, defaults={"is_admin": is_admin}
)
Mostly, it doesn't make much sense to me why there are essentially three different ways of doing the same thing (aside from the get_or), but three very different way of treating any additional user kwargs and it should likely be made consistent.
Unless there's good reason for this current setup?
In
OrganizationBase, theadd_userfunction has this signature:def add_user(self, user, **kwargs)and creates a newOrganizationUserwith thekwargs:However, in
AbstractOrganization, theadd_userfunction has this signature:def add_user(self, user, is_admin=False)and creates a newOrganizationUserwith:And finally, also in
AbstractOrganization, there is aget_or_add_userfunction with this signature:def get_or_add_user(self, user, **kwargs), except it only checks foris_admininkwargs, ignoring anything else creating a newOrganizationUserwith:Mostly, it doesn't make much sense to me why there are essentially three different ways of doing the same thing (aside from the
get_or), but three very different way of treating any additional userkwargsand it should likely be made consistent.Unless there's good reason for this current setup?