How to Set Your User as Staff or Superuser - DesignSafe-CI/portal GitHub Wiki

Some tasks require a developer to have a user with staff-level permissions.

Use Cases

  • To be able to work in the CMS admin interface to change user-facing content.

Steps

  1. Login to docker shell:

    docker exec -it des_django /bin/bash
    
  2. Enter python shell:

    python manage.py shell
    
  3. Find & Update your user:

    from django.contrib.auth import get_user_model
    my_user = get_user_model().objects.get(username="my_username")
    # Set your local user to be "staff" or "superuser"
    my_user.is_staff = True
    my_user.is_superuser = True
    my_user.save()
    

Related