Пример #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)