Skip to content

Create New Users Database Transaction #388

@F0rcey

Description

@F0rcey

Okay, so might be a bit of an edge case, but someone else might stumble into the same issue as me.
I'm using this (great) library to add Single Sign On Functionality to a Taiga Kanban Board, which is based on Django.
Taiga sets the user e-mail as unique and non nullable (at least in it's Django Model).
I have the setting "CREATE_NEW_USERS" set to true, so that new employees can login without having to manually create a user with their username.

Problem: if a user with the same mail already exists in the DB, create_new_users creates an empty user (only username is set), and commits it to the Database, before remaining attributes, groups and flags are set.
This also means that, if there is a user in the Database without a mail set and mails have to be unique, creation of new users will always fail, since the creation of users is not in a single database transaction, but rather creates them in 4 single steps (user, attributes, groups, flags).

Image Image

Creation of new users should be in a single database transaction, so that valid users can be created without running into this issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions