Skip to content

Latest commit

 

History

History
51 lines (30 loc) · 1.13 KB

manage_users.md

File metadata and controls

51 lines (30 loc) · 1.13 KB

Manage Users

  • Create artifactory client

      from artifactory import Artifactory
      artifactory = Artifactory(
              url="http://127.0.0.1:8081",
              username="admin",
              password="password",
              )
    
  • List users

      user_list = artifactory.security.users.list()
    
  • Fetch user

      user = artifactory.security.users.fetch("first.last")
    
  • Create user

      user = artifactory.security.users.new()
      user.name = "first.last"
      user.password = "test"
      user.email = "[email protected]"
      user.groups = ["readers"]
      response = user.create()
    
  • Update user

      user = artifactory.security.users.fetch("first.last")
      user.password = "test"  # password is required to update account details
      user.admin = False
      response = user.update()
    
  • Remove user

      user = artifactory.security.users.fetch("first.name")
      response = user.remove()
    
  • Required/optional fields

      print user.required
      print user.optional