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

Create super user on app install #946

Open
2 of 9 tasks
AndyRae opened this issue Feb 17, 2025 · 2 comments · May be fixed by #964
Open
2 of 9 tasks

Create super user on app install #946

AndyRae opened this issue Feb 17, 2025 · 2 comments · May be fixed by #964
Assignees

Comments

@AndyRae
Copy link
Member

AndyRae commented Feb 17, 2025

Is this the right issue type?

  • Yes, I'm planning work for this project team.

Summary

Adding a default super user for Carrot when it is first installed would be very helpful.

Currently the install documentation asks that this is done locally: https://carrot.ac.uk/mapper/deployment/azure/steps#backend-app

A Django superuser also need creating by connecting to the Backend app and run the command:

python manage.py createsuperuser

We would like to do this through a management command, that will check if any users exist - and if they do not create one. This prevents super users being created by mistake.

The default credentials should be:

username: admin
password: Password123! (this should be capable of being overridden by environment variables)

Acceptance Criteria

  • When Carrot starts with a blank user database, a super user is created.
  • If users exist in the database, no super user is created.
  • The super user password is configurable through environment variables

Tasks

  • A new management command
  • Checks if users exists
  • If not - create a new user
  • Have password be configurable through environment variable, and a set a default

Confirm creation

  • This issue is ready
@github-project-automation github-project-automation bot moved this to MoreInfo in Carrot Backlog Feb 17, 2025
@AndyRae AndyRae moved this from MoreInfo to Committed in Carrot Backlog Feb 17, 2025
@AndyRae
Copy link
Member Author

AndyRae commented Feb 17, 2025

Say this is the default passwrod for a super user if they are seeded

settings.py

DEFAULT_PASSWORD = os.getenv("SUPERUSER_DEFAULT_PASSWORD", "Password123")

@anwarfg anwarfg moved this from Committed to In Progress in Carrot Backlog Feb 20, 2025
@g-pechorin g-pechorin mentioned this issue Feb 26, 2025
2 tasks
@g-pechorin
Copy link

i need to pass tests (oops) and add my own (d'oh)

@g-pechorin g-pechorin linked a pull request Mar 5, 2025 that will close this issue
2 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: In Progress
2 participants