예제 #1
0
    def updateUser(self, params):
        user_dao = self.locator.getDAO("user")

        if not user_dao.isExistfromKey("user_id", params["user_id"]):
            raise ERROR_INVALID_PARAMETER(key="user_id", value=params["user_id"])

        dic = {}

        if params.has_key("password"):
            if not utils.checkPasswordFormat(params["password"]):
                raise ERROR_INVALID_PASSWORD_FORMAT()

            dic["password"] = make_password(params["password"])

        if params.has_key("name"):
            dic["name"] = params["name"]

        if params.has_key("state"):
            dic["state"] = params["state"]

        if params.has_key("email"):
            dic["email"] = params["email"]

        if params.has_key("language"):
            dic["language"] = params["language"]

        if params.has_key("timezone"):
            dic["timezone"] = params["timezone"]

        user_dao.update(params["user_id"], dic, "user_id")

        return self.locator.getInfo("UserInfo", params["user_id"])
예제 #2
0
    def createUser(self, params):
        user_dao = self.locator.getDAO("user")

        if user_dao.isExistfromKey("user_id", params["user_id"]):
            raise ERROR_EXIST_RESOURCE(key="user_id", value=params["user_id"])

        if not utils.checkIDFormat(params["user_id"]):
            raise ERROR_INVALID_ID_FORMAT()

        if not utils.checkPasswordFormat(params["password"]):
            raise ERROR_INVALID_PASSWORD_FORMAT()

        dic = {}
        dic["user_id"] = params["user_id"]
        dic["password"] = make_password(params["password"])

        if params.has_key("name"):
            dic["name"] = params["name"]

        if params.has_key("email"):
            dic["email"] = params["email"]

        if params.has_key("language"):
            dic["language"] = params["language"]
        else:
            dic["language"] = global_conf.DEFAULT_LANGUAGE

        if params.has_key("timezone"):
            dic["timezone"] = params["timezone"]
        else:
            dic["timezone"] = global_conf.DEFAULT_TIMEZONE

        user = user_dao.insert(dic)

        return self.locator.getInfo("UserInfo", user.user_id)
예제 #3
0
    def createUser(self, params):
        user_dao = self.locator.getDAO('user')

        if user_dao.isExistfromKey('user_id', params['user_id']):
            raise ERROR_EXIST_RESOURCE(key='user_id', value=params['user_id'])

        if not utils.checkIDFormat(params['user_id']):
            raise ERROR_INVALID_ID_FORMAT()

        if not utils.checkPasswordFormat(params['password']):
            raise ERROR_INVALID_PASSWORD_FORMAT()

        dic = {}
        dic['user_id'] = params['user_id']
        dic['password'] = make_password(params['password'])

        if params.has_key('name'):
            dic['name'] = params['name']

        if params.has_key('email'):
            dic['email'] = params['email']

        if params.has_key('language'):
            dic['language'] = params['language']
        else:
            dic['language'] = global_conf.DEFAULT_LANGUAGE

        if params.has_key('timezone'):
            dic['timezone'] = params['timezone']
        else:
            dic['timezone'] = global_conf.DEFAULT_TIMEZONE

        user = user_dao.insert(dic)

        return self.locator.getInfo('UserInfo', user.user_id)
예제 #4
0
    def updateUser(self, params):
        user_dao = self.locator.getDAO('user')

        if not user_dao.isExistfromKey('user_id', params['user_id']):
            raise ERROR_INVALID_PARAMETER(key='user_id',
                                          value=params['user_id'])

        dic = {}

        if params.has_key('password'):
            if not utils.checkPasswordFormat(params['password']):
                raise ERROR_INVALID_PASSWORD_FORMAT()

            dic['password'] = make_password(params['password'])

        if params.has_key('name'):
            dic['name'] = params['name']

        if params.has_key('state'):
            dic['state'] = params['state']

        if params.has_key('email'):
            dic['email'] = params['email']

        if params.has_key('language'):
            dic['language'] = params['language']

        if params.has_key('timezone'):
            dic['timezone'] = params['timezone']

        user_dao.update(params['user_id'], dic, 'user_id')

        return self.locator.getInfo('UserInfo', params['user_id'])
예제 #5
0
    def updateUser(self, params):
        user_dao = self.locator.getDAO('user') 

        if not user_dao.isExist(user_id=params['user_id']):
            raise ERROR_INVALID_PARAMETER(key='user_id', value=params['user_id'])

        dic = {}

        if params.has_key('password'):
            if not utils.checkPasswordFormat(params['password']):
                raise ERROR_INVALID_PASSWORD_FORMAT()

            dic['password'] = make_password(params['password'])

        if params.has_key('name'):
            dic['name'] = params['name']

        if params.has_key('state'):
            dic['state'] = params['state']

        if params.has_key('email'):
            dic['email'] = params['email']

        if params.has_key('language'):
            dic['language'] = params['language']

        if params.has_key('timezone'):
            dic['timezone'] = params['timezone']


        user = user_dao.update(params['user_id'], dic, 'user_id')

        return self.locator.getInfo('UserInfo', user)
예제 #6
0
    def createUser(self, params):
        user_dao = self.locator.getDAO('user') 

        if user_dao.isExist(user_id=params['user_id']):
            raise ERROR_EXIST_RESOURCE(key='user_id', value=params['user_id'])

        if not utils.checkIDFormat(params['user_id']):
            raise ERROR_INVALID_ID_FORMAT()

        if not utils.checkPasswordFormat(params['password']):
            raise ERROR_INVALID_PASSWORD_FORMAT()

        dic = {}
        dic['user_id'] = params['user_id']
        dic['password'] = make_password(params['password'])

        if params.has_key('name'):
            dic['name'] = params['name']

        if params.has_key('email'):
            dic['email'] = params['email']

        if params.has_key('language'):
            dic['language'] = params['language']
        else:
            dic['language'] = self.GLOBAL_CONF['DEFAULT_LANGUAGE']

        if params.has_key('timezone'):
            dic['timezone'] = params['timezone']
        else:
            dic['timezone'] = self.GLOBAL_CONF['DEFAULT_TIMEZONE']

        user = user_dao.insert(dic)

        return self.locator.getInfo('UserInfo', user)
예제 #7
0
    def createUser(self, params):
        user_dao = self.locator.getDAO('user')

        if user_dao.isExist(user_id=params['user_id']):
            raise ERROR_EXIST_RESOURCE(key='user_id', value=params['user_id'])

        if not utils.checkIDFormat(params['user_id']):
            raise ERROR_INVALID_ID_FORMAT()

        if not utils.checkPasswordFormat(params['password']):
            raise ERROR_INVALID_PASSWORD_FORMAT()

        dic = {}
        dic['user_id'] = params['user_id']
        dic['password'] = make_password(params['password'])

        if params.has_key('name'):
            dic['name'] = params['name']

        if params.has_key('email'):
            dic['email'] = params['email']

        if params.has_key('language'):
            dic['language'] = params['language']
        else:
            dic['language'] = self.GLOBAL_CONF['DEFAULT_LANGUAGE']

        if params.has_key('timezone'):
            dic['timezone'] = params['timezone']
        else:
            dic['timezone'] = self.GLOBAL_CONF['DEFAULT_TIMEZONE']

        if params.has_key('group_id'):
            group_dao = self.locator.getDAO('group')

            groups = group_dao.getVOfromKey(uuid=params['group_id'])

            if groups.count() == 0:
                raise ERROR_INVALID_PARAMETER(key='group_id',
                                              value=params['group_id'])

            dic['group'] = groups[0]

        user = user_dao.insert(dic)

        return self.locator.getInfo('UserInfo', user)