Steps:
Rework all unit tests data creation to use noodleauth.tests.data function create_test_user to which optional parameters can be passed to override default
field values used to create test user.
Once this effort is complete, rest of team should start using this function to
create users within unit tests. Unit tests won't be affected by "internal" noodleauth changes ("internal" in this context means changes that are within immediate app only).
- fix current standards-non-compliant code (including camelCased variables/field/class names)
- manually rename columns via south
- assess how to remove
extendedDatafield- TODO
- retain
nice_keybut dispose ofnoodle_key - rework
NoodleUserstoUserProfiletable- options:
- use
usernamefromdjango.auth.models.Userinstead of the currentNoodleUsersclass
- if still relying on email for user identification, retain current substitution of User model, but still rename variables (i.e. stop using
usernamefor a variable that actually stored anemailaddress!)
- use
- model as 1:1 relationship
auth.User <=> noodleauth.models.Profileornoodleauth.User <=> noodleauth.models.Profileinstead of what's being currently done, in order to separate user profile related info from user authentication related info
- options:
- investigate the logic behind the
set_default_singly_passwordfunction- this stuff should be happening in the singly authentication backend, i.e.
noodleauth.auth_backend.SinglyAuthBackend - TODO: get an overview of how this singly process works; and remove any singly-specific logic/artefacts out of the noodleauth.models class which houses only the generic user profile applicable to all backends
- this stuff should be happening in the singly authentication backend, i.e.
- after @jcalazan reworks the default hasher for passwords to internally like exactly as in
AbstractBaseUserpassword management- try to remove all password handling logic out of
noodleauth.modelsand relocate it in the auth backend it belongs to
- try to remove all password handling logic out of
- class
AdminRole- this class is practically redundant because
auth.userhas bothis_activeandis_admin(and alsoAbstractBaseUserhasis_active, in case the default User model is substituted; onlyis_adminwould require re-definition) and this practically "groups" permissions - TODO: discuss with @rlepore
- this class is practically redundant because
Coding approaches outside App:
- Advise 16.1 in TSOD: in code outside app always use Django's tools to retrieve user model:
>>> from django.contrib.auth import get_user_model
>>> get_user_model()
<class 'django.contrib.auth.models.User'>
- Use settings.AUTH USER MODEL for Foreign Keys to User (recommended by Django docs):
from django.conf import settings
...
owner = models.OneToOneField(settings.AUTH_USER_MODEL)
- change unit tests to use the fastest hasher, i.e. put this in
settings.test(should reduce current test suite's execution time by a half at least):
PASSWORD_HASHERS = (
'django.contrib.auth.hashers.MD5PasswordHasher',
)