예제 #1
0
파일: user.py 프로젝트: 9wfox/robot
    def post(self):
        """
            args:
                uid
                username
                email
                nickname
        """
        kwargs = dict((k, v[-1]) for k, v in self.request.arguments.items())
        uid = kwargs.pop('uid')
        not_empty(kwargs.get('username'), kwargs.get('email'))

        mongo_util.m_update(T_PASSPORT, {'_id': ObjectId(uid)},  **kwargs)

        self.write(dict(status = True, data = uid))
예제 #2
0
파일: user.py 프로젝트: 9wfox/robot
    def post(self):
        """
            args:
                username
                email
                nickname

                companyid: 如果给单位添加用户需要提供单位id
        """
        kwargs = dict((k, v[-1]) for k, v in self.request.arguments.items())
        companyid = kwargs.pop('companyid', None)
        status, uid = add_passport(**kwargs)
        if not status:
            self.write(dict(status = False, data = uid))
            return

        mongo_util.m_update(T_ACCESS, {'_id': ObjectId(uid)}, upsert = True)
        self.write(dict(status = True, data = uid))
예제 #3
0
파일: user.py 프로젝트: 9wfox/robot
 def post(self):
     """
         args:
             uid
             password
     """
     uid = self.get_argument('uid')
     password = self.get_argument('password')
     status = mongo_util.m_update(T_PASSPORT, {'_id': ObjectId(uid)},
                                         pwd = hashlib.md5(password).hexdigest())
     self.write(dict(status = status))
예제 #4
0
파일: user.py 프로젝트: 9wfox/robot
    def post(self):
        """
            args:
                uid
                roleid
        """
        uid = self.get_argument('uid')
        roleid = self.get_argument('roleid')

        status = mongo_util.m_update(T_PASSPORT, {'_id': ObjectId(uid)}, roleid = roleid)

        self.write(dict(status = status))
예제 #5
0
파일: role.py 프로젝트: 9wfox/robot
    def post(self):
        """
            args:
                _id
                name or remark or access
                access: a|b|c
        """
        kwargs = dict((k, v[-1]) for k, v in self.request.arguments.items())
        roleid = kwargs.pop('_id', None)
        if kwargs.has_key('access'):
            kwargs['access'] = kwargs.get('access').split('|')

        status = mongo_util.m_update(T_ROLE, {'_id': ObjectId(roleid)}, **kwargs)
        self.write(dict(status = status))
예제 #6
0
파일: user.py 프로젝트: 9wfox/robot
    def post(self):
        """
            args:
                uid
                access: a|b|c
        """
        uid = self.get_argument('uid')
        access = self.get_argument('access')
        not_empty(uid)
        if access:
            access = access.split('|')
        else:
            access = []

        status = mongo_util.m_update(T_ACCESS, {'_id': ObjectId(uid)}, upsert = True, access = access)
        self.write(dict(status = status))