示例#1
0
 def update_user_groups(username, password, groups):
     try:
         api = UserService(settings.OPENFIRE_ADDRESS,
                           settings.OPENFIRE_SECRET_KEY)
         api.update_user(username, password, "", "", groups)
     except exception.HTTPException as e:
         print e
示例#2
0
 def delete_user(username):
     try:
         api = UserService(settings.OPENFIRE_ADDRESS, settings.OPENFIRE_SECRET_KEY)
         api.delete_user(username)
         return True
     except exception.UserNotFoundException:
         return False
示例#3
0
 def update_user_pass(username):
     try:
         password = OpenfireManager.__generate_random_pass()
         api = UserService(settings.OPENFIRE_ADDRESS, settings.OPENFIRE_SECRET_KEY)
         api.update_user(username, password)
         return password
     except exception.UserNotFoundException:
         return ""
示例#4
0
 def delete_user(username):
     try:
         api = UserService(settings.OPENFIRE_ADDRESS,
                           settings.OPENFIRE_SECRET_KEY)
         api.delete_user(username)
         return True
     except exception.UserNotFoundException:
         return False
示例#5
0
 def update_user_pass(username):
     try:
         password = OpenfireManager.__generate_random_pass()
         api = UserService(settings.OPENFIRE_ADDRESS,
                           settings.OPENFIRE_SECRET_KEY)
         api.update_user(username, password)
         return password
     except exception.UserNotFoundException:
         return ""
示例#6
0
    def add_user(username):

        try:
            sanatized_username = OpenfireManager.__santatize_username(username)
            password = OpenfireManager.__generate_random_pass()
            api = UserService(settings.OPENFIRE_ADDRESS, settings.OPENFIRE_SECRET_KEY)
            api.add_user(sanatized_username, password)

        except exception.UserAlreadyExistsException:
            # User exist
            return "", ""

        return sanatized_username, password
示例#7
0
    def add_user(username):

        try:
            sanatized_username = OpenfireManager.__santatize_username(username)
            password = OpenfireManager.__generate_random_pass()
            api = UserService(settings.OPENFIRE_ADDRESS,
                              settings.OPENFIRE_SECRET_KEY)
            api.add_user(sanatized_username, password)

        except exception.UserAlreadyExistsException:
            # User exist
            return "", ""

        return sanatized_username, password
示例#8
0
def add_xmpp_jid(jid):
    #Get xmpp server url from properties.py file
    xmppServer = properties.xmppServerUrl
    #Login to the xmpp server
    api = UserService(xmppServer, "skAljQTm43929-49sdakl")
    try:
        #Add users from the input csv file
        userAddReturnValue = api.add_user(jid, "skAljQTm43929-49sdakl")
        print "User " + jid + " added successfully!!"
        #print userAddReturnValue
    except UserAlreadyExistsException:
        print "User " + jid + " already exists!"
    except UserNotFoundException:
        print "User " + jid + " not found!!"
    except InvalidResponseException:
        print "Invalid request"
    except RequestNotAuthorisedException:
        print "Request is not authorized"
示例#9
0
    def delete_user_groups(username, groups):

        api = UserService(settings.OPENFIRE_ADDRESS, settings.OPENFIRE_SECRET_KEY)
        api.delete_group(username, groups)
示例#10
0
 def update_user_groups(username, password, groups):
     try:
         api = UserService(settings.OPENFIRE_ADDRESS, settings.OPENFIRE_SECRET_KEY)
         api.update_user(username, password, "", "", groups)
     except exception.HTTPException as e:
         print e
示例#11
0
 def unlock_user(username):
     api = UserService(settings.OPENFIRE_ADDRESS, settings.OPENFIRE_SECRET_KEY)
     api.unlock_user(username)
示例#12
0
 def unlock_user(username):
     api = UserService(settings.OPENFIRE_ADDRESS,
                       settings.OPENFIRE_SECRET_KEY)
     api.unlock_user(username)
示例#13
0
    def delete_user_groups(username, groups):

        api = UserService(settings.OPENFIRE_ADDRESS,
                          settings.OPENFIRE_SECRET_KEY)
        api.delete_group(username, groups)