How to Set Your User as Staff (or Superuser) - TACC/Core-CMS GitHub Wiki

After a user logs in via Portal, they cannot immediately login to CMS. Their user must be given "Staff status".

Steps

via Django CMS Admin (as another admin)

  1. Login.
  2. Visit Django CMS admin.
  3. Find and edit the user to become staff.
  4. Check the "Staff status" checkbox.
  5. Save.

via Console (as an authorized developer)

  1. Completely shut down all of your containers and restart them.

  2. Login to docker shell:

    docker exec -it core_portal_cms /bin/bash
    
  3. Enter python shell:

    python manage.py shell
    
  4. 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()
    
  5. (If needed) Inspect SetupEvents to view logs

    from portal.apps.onboarding.models import SetupEvent
    # Get your user model (change "my_username" to your username)
    # Inspect your user setup events, if things go wrong and we need additional debugging data
    events = SetupEvent.objects.all().filter(user=my_user)
    print(events)
    

Related