添加组织及组织管理员说明

  • jumpserver 1.4.0 或之后版本
  1. $ source /opt/py3/bin/activate
  2. $ cd /opt/jumpserver/apps
  3. $ python manage.py shell
  4. >>> from assets.models import Asset
  5. >>> from orgs.models import Organization
  6. >>> from users.models import User
  7. >>> dev_org = Organization.objects.create(name='开发部')
  8. >>> user = User.objects.create(name='用户', username='user', email='user@jumpserver.org')
  9. >>> user.set_password('PassWord')
  10. >>> user.save()
  11. >>> dev_org.admins.add(user)
  12. >>> dev_org.users.add(user)
  13. >>> exit()
  14.  
  15. # 然后使用 user 用户登录 jumpserver 即可

向现有组织加入管理员

  1. $ source /opt/py3/bin/activate
  2. $ cd /opt/jumpserver/apps
  3. $ python manage.py shell
  4. >>> from assets.models import Asset
  5. >>> from orgs.models import Organization
  6. >>> from users.models import User
  7. >>> dev_org = Organization.objects.get(name='开发部')
  8. >>> user = User.objects.get(username='admin')
  9. >>> dev_org.admins.add(user)
  10. >>> exit()

向现有组织加入已存在用户

  1. $ source /opt/py3/bin/activate
  2. $ cd /opt/jumpserver/apps
  3. $ python manage.py shell
  4. >>> from assets.models import Asset
  5. >>> from orgs.models import Organization
  6. >>> from users.models import User
  7. >>> dev_org = Organization.objects.get(name='开发部')
  8. >>> user = User.objects.get(username='admin')
  9. >>> dev_org.users.add(user)
  10. >>> exit()

向现有组织加入新建的用户

  1. $ source /opt/py3/bin/activate
  2. $ cd /opt/jumpserver/apps
  3. $ python manage.py shell
  4. >>> from assets.models import Asset
  5. >>> from orgs.models import Organization
  6. >>> from users.models import User
  7. >>> dev_org = Organization.objects.get(name='开发部')
  8. >>> user = User.objects.create(name='测试用户', username='test', email='test@jumpserver.org')
  9. >>> user.set_password('PassWord')
  10. >>> user.save()
  11. >>> dev_org.users.add(user)
  12. >>> exit()