Example #1
0
 def get(self):
     the_post = Get()
     self.set_format(the_post.get_format(self))
     instance = LogicGetBasicData()
     result = instance.get()
     OHHOLog.print_log(result)
     return self.response(result)
Example #2
0
 def get(self):
     the_get = Get()
     self.set_format(the_get.get_format(self))
     identity_id = the_get.get_device_identity_id(self)
     instance = LogicFindDevicePosition()
     result = instance.find_device_position(identity_id)
     return self.response(result)
    def get(self):
        the_get = Get()
        user_instance = User()
        relation_instance = UserAndMatchCondition()

        user_and_match_condition_id = the_get.get_id(self)
        relation = relation_instance.get_by_id(user_and_match_condition_id)
        username = ""
        match_condition_id = ""
        name = ""
        if relation:
            user = user_instance.get_by_id(relation.user_id)
            username = user.username
            if relation.match_condition_id is not None:
                match_condition_id = relation.match_condition_id
            if relation.name is not None:
                name = relation.name

        return self.render(USER_AND_MATCH_CONDITION_DETAIL_HTML,
                           username=username,
                           name=name,
                           match_condition_id=match_condition_id,
                           user_and_match_condition_id=user_and_match_condition_id,
                           detail_url=USER_AND_MATCH_CONDITION_DETAIL_URL,
                           list_url=USER_AND_MATCH_CONDITION_LIST_URL
                           )
Example #4
0
 def get(self):
     the_get = Get()
     group_id = the_get.get_id(self)
     if group_id:
         instance_staff = DBOHHOStaff()
         instance_group_staff_relation = OHHOPermission().group_and_staff
         staffs = instance_staff.get_query()
         staffs = instance_staff.get_valid(staffs)
         staffs = instance_staff.get_all(staffs)
         staff_list = list()
         group_staff_list = list()
         group_staffs = instance_group_staff_relation.get_by_group_id(
             group_id)
         group_staffs = instance_group_staff_relation.get_all(group_staffs)
         if staffs:
             for staff in staffs:
                 if group_staffs:
                     for group_staff in group_staffs:
                         if staff.username == group_staff.username:
                             group_staff_list.append(staff)
                 staff_list.append(staff)
         staff_list = list(set(staff_list) - set(group_staff_list))
         return self.render(
             PERMISSION_GROUP_STAFF_RELATION_HTML,
             add_url=PERMISSION_GROUP_STAFF_RELATION_ADD_URL,
             delete_url=PERMISSION_GROUP_STAFF_RELATION_DELETE_URL,
             list_url=PERMISSION_GROUP_BACKSTAGE_LIST_URL,
             group_id=group_id,
             staff_list=staff_list,
             group_staff_list=group_staff_list,
         )
     else:
         return self.redirect(PERMISSION_GROUP_BACKSTAGE_LIST_URL)
 def get(self):
     result = dict()
     the_get = Get()
     self.set_format(the_get.get_format(self))
     interest = DBOHHOInterest()
     result["type"] = interest.get_report_type()
     return self.response(result)
Example #6
0
    def get(self):
        the_get = Get()
        the_id = the_get.get_id(self)
        instance = Hint()
        obj = instance.get_by_id(the_id)
        name = obj.name if obj else ""
        key = obj.key if obj else ""
        description = obj.description if obj else ""
        parent = instance.get_by_id(obj.parent_id) if obj else None
        parent_id = parent.id if parent else 0
        parent_name = parent.name if parent else ""
        parent_key = parent.key if parent else ""
        parent_description = parent.description if parent else ""
        message = ""

        return self.render(BASE_HINT_BACKSTAGE_DELETE_HTML,
                           name=name,
                           key=key,
                           description=description,
                           parent_id=parent_id,
                           parent_name=parent_name,
                           parent_key=parent_key,
                           parent_description=parent_description,
                           delete_url=BASE_HINT_BACKSTAGE_DELETE_URL,
                           list_url=BASE_HINT_BACKSTAGE_LIST_URL,
                           message=message)
Example #7
0
    def get(self):
        user_instance = DBOHHOUser()
        cellphone_instance = DBCellphone()
        relation_instance = DBOHHOUserAndCellphoneRelation()

        the_get = Get()
        relation_id = the_get.get_id(self)
        username = ""
        cellphone_key = ""
        state = False
        if relation_id:
            relation = relation_instance.get_by_id(relation_id)
            if relation:
                state = relation.state
                user = user_instance.get_by_id(relation.user_id)
                username = user.username if user else ""
                cellphone = cellphone_instance.get_by_id(relation.cellphone_id)
                cellphone_key = cellphone.key if cellphone else ""

        return self.render(USER_AND_CELLPHONE_DETAIL_HTML,
                           username=username,
                           cellphone_key=cellphone_key,
                           state=state,
                           relation_id=relation_id,
                           detail_url=USER_AND_CELLPHONE_DETAIL_URL,
                           list_url=USER_AND_CELLPHONE_LIST_URL)
Example #8
0
    def get(self):
        the_get = Get()
        instance = SensitiveBackstage()
        query = instance.get_all()
        name = the_get.get_name(self)
        if name:
            query = instance.find_by_name(query, name)

        page = the_get.get_page(self)
        data_count_per_page = the_get.get_data_count_per_page(self)
        page_count_per_page = the_get.get_page_count_per_page(self)
        offset = (page - 1) * data_count_per_page
        limit = data_count_per_page

        query, count = instance.get_some(query, offset, limit)
        total_page = int(ceil(count / data_count_per_page))
        pagination = Pagination(total_page, page, data_count_per_page, page_count_per_page)
        page_list, previous, next = pagination.get_page_list_of_this_page()

        return self.render(BASE_SENSITIVE_BACKSTAGE_LIST_HTML,
                           sensitive_list=query,
                           pages=page_list,
                           previous=previous,
                           next=next,
                           page=page,
                           name=name,
                           home_list_url=MANAGEMENT_BASE_HOME_URL,
                           list_url=BASE_SENSITIVE_BACKSTAGE_LIST_URL,
                           detail_url=BASE_SENSITIVE_BACKSTAGE_DETAIL_URL,
                           add_url=BASE_SENSITIVE_BACKSTAGE_ADD_URL,
                           delete_url=BASE_SENSITIVE_BACKSTAGE_DELETE_URL,
                           )
Example #9
0
 def get(self):
     the_get = Get()
     code = the_get.get_code(self)
     message = the_get.get_data(self)
     return self.render("backstage/no_permission.html",
                        code=code,
                        message=message)
 def get(self):
     the_get = Get()
     group_id = the_get.get_id(self)
     if group_id:
         instance_user = DBOHHOUser()
         instance_group_user_relation = OHHOPermission().group_and_user
         users = instance_user.get_query()
         users = instance_user.get_valid(users)
         users = instance_user.get_all(users)
         user_list = list()
         group_user_list = list()
         group_users = instance_group_user_relation.get_by_group_id(
             group_id)
         group_users = instance_group_user_relation.get_all(group_users)
         if users:
             for user in users:
                 if group_users:
                     for group_user in group_users:
                         if user.username == group_user.username:
                             group_user_list.append(user)
                 user_list.append(user)
         user_list = list(set(user_list) - set(group_user_list))
         return self.render(
             PERMISSION_GROUP_USER_RELATION_HTML,
             add_url=PERMISSION_GROUP_USER_RELATION_ADD_URL,
             delete_url=PERMISSION_GROUP_USER_RELATION_DELETE_URL,
             list_url=PERMISSION_GROUP_BACKSTAGE_LIST_URL,
             group_id=group_id,
             user_list=user_list,
             group_user_list=group_user_list,
         )
     else:
         return self.redirect(PERMISSION_GROUP_BACKSTAGE_LIST_URL)
Example #11
0
    def get(self):
        the_get = Get()
        im_user_id = the_get.get_id(self)

        im_user_instance = IMUser()
        ohho_user_instance = OHHOUser()

        im_user = im_user_instance.get_by_id(im_user_id)
        username = ""
        token = ""
        name = ""
        if im_user:
            ohho_user = ohho_user_instance.get_by_id(im_user.account_id)
            username = ohho_user.username
            if im_user.token is not None:
                token = im_user.token
            if im_user.name is not None:
                name = im_user.name
            state = im_user.state

        return self.render(IM_USER_DETAIL_HTML,
                           username=username,
                           token=token,
                           name=name,
                           state=state,
                           im_user_id=im_user_id,
                           detail_url=IM_USER_DETAIL_URL,
                           list_url=IM_USER_LIST_URL
                           )
    def get(self):
        the_get = Get()
        relation_id = the_get.get_id(self)
        username = ""
        identity_id = ""
        state = False
        user_instance = DBOHHOUser()
        device_instance = DBOHHODevice()
        relation_instance = DBOHHOUserAndDeviceRelation()
        if relation_id:
            relation = relation_instance.get_by_id(relation_id)
            if relation:
                state = relation.state
                user = user_instance.get_by_id(relation.user_id)
                username = user.username if user else ""
                device = device_instance.get_by_id(relation.device_id)
                identity_id = device.identity_id if device else ""

        return self.render(
            USER_AND_DEVICE_DELETE_HTML,
            username=username,
            identity_id=identity_id,
            state=state,
            detail_url=USER_AND_DEVICE_DETAIL_URL,
            list_url=USER_AND_DEVICE_LIST_URL,
            delete_url=USER_AND_DEVICE_DELETE_URL,
        )
Example #13
0
    def get(self):
        the_get = Get()
        device_id = the_get.get_device_id(self)
        instance = Device()
        device = instance.get_by_id(device_id)

        return self.render(MANAGEMENT_DEVICE_DELETE_HTML, device=device)
Example #14
0
    def _authenticate(self):
        method = self.request.method
        token_instance = Token()
        if method == "POST":
            the_post = Post()
            the_header = Headers()
            user_id = the_post.get_user_id(self)
            user_id = user_id if user_id else the_header.get_user_id(self)
            token = the_post.get_token(self)
            token = token if token else the_header.get_token(self)

            token_from_db = token_instance.get(user_id)
            if token_from_db and token_from_db.token == token:
                result = func(self)
            else:
                return self.write(
                    OHHOOperation.dict2json(Result.result_not_login()))
        elif method == "GET":
            the_get = Get()
            the_header = Headers()
            user_id = the_get.get_user_id(self)
            user_id = user_id if user_id else the_header.get_user_id(self)
            token = the_get.get_token(self)
            token = token if token else the_header.get_token(self)

            token_from_db = token_instance.get(user_id)

            if token_from_db and token_from_db.token == token:
                result = func(self)
            else:
                return self.write(
                    OHHOOperation.dict2json(Result.result_not_login()))
        else:
            result = func(self)
        return result
Example #15
0
    def get(self):
        the_get = Get()
        instance = MatchLabel()

        page = the_get.get_page(self)
        data_count_per_page = the_get.get_data_count_per_page(self)
        page_count_per_page = the_get.get_page_count_per_page(self)
        offset = (page - 1) * data_count_per_page
        limit = data_count_per_page

        query = instance.get_query()

        query, count = instance.get_some(query, offset, limit)
        total_page = int(ceil(count / data_count_per_page))
        pagination = Pagination(total_page, page, data_count_per_page,
                                page_count_per_page)
        page_list, previous, next = pagination.get_page_list_of_this_page()

        return self.render(
            BASE_MATCH_LABEL_LIST_HTML,
            labels=query,
            pages=page_list,
            previous=previous,
            next=next,
            page=page,
            home_list_url=MANAGEMENT_BASE_HOME_URL,
            list_url=BASE_MATCH_LABEL_LIST_URL,
            detail_url=BASE_MATCH_LABEL_DETAIL_URL,
            add_url=BASE_MATCH_LABEL_ADD_URL,
        )
Example #16
0
    def get(self):
        result = dict()
        the_get = Get()
        self.set_format(the_get.get_format(self))
        interest = DBOHHOInterest()

        result["type"] = interest.get_cancel_meet_feedback_type()
        return self.response(result)
Example #17
0
    def get(self):
        the_post = Get()
        self.set_format(the_post.get_format(self))
        base_url = the_post.get_base_url(self)

        instance = LogicMeetTopic()
        result = instance.meet_topic()
        return self.response(result)
Example #18
0
    def get(self):
        params = Get()
        self.set_format(params.get_format(self))
        cellphone = params.get_cellphone_number(self)
        country_code = params.get_cellphone_country_code(self)

        instance = LogicExistCellphone()
        result = instance.exist(country_code, cellphone)
        return self.response(result)
Example #19
0
    def get(self):
        the_get = Get()
        user_id = the_get.get_user_id(self)
        friend_id = the_get.get_friend_id(self)
        latitude = the_get.get_friend_id(self)
        longitude = the_get.get_friend_id(self)

        instance = LogicMapDistance()
        result = instance.map_distance(user_id, friend_id, latitude, longitude)
        return self.write(OHHOOperation.dict2json(result))
Example #20
0
    def get(self):
        the_get = Get()
        staff_id = the_get.get_staff_id(self)
        instance = Staff()
        staff = instance.get_by_id(staff_id)
        country_code = instance.country_code.get_query()

        return self.render(MANAGEMENT_STAFF_DETAIL_HTML,
                           staff=staff,
                           country_code_list=country_code)
Example #21
0
 def get(self):
     the_get = Get()
     self.set_format(the_get.get_format(self))
     country_code = the_get.get_cellphone_country_code(self)
     cellphone_number = the_get.get_cellphone_number(self)
     code = the_get.get_code(self)
     the_cellphone = country_code + cellphone_number
     result = LogicCheckVerificationCode.check_verification_code(
         the_cellphone, code)
     return self.response(result)
Example #22
0
 def get(self):
     the_get = Get()
     group_id = the_get.get_id(self)
     instance = OHHOPermission()
     if group_id:
         group_obj = instance.group.get_by_id(group_id)
     return self.render(PERMISSION_GROUP_BACKSTAGE_DELETE_HTML,
                        group_obj=group_obj,
                        delete_url=PERMISSION_GROUP_BACKSTAGE_DELETE_URL,
                        list_url=PERMISSION_GROUP_BACKSTAGE_LIST_URL)
Example #23
0
    def get(self):
        the_get = Get()
        cellphone_key = the_get.get_cellphone_key(self)
        instance = Cellphone(cellphone_key)
        cellphone = instance.get()

        return self.render(
            MANAGEMENT_CELLPHONE_DELETE_HTML,
            cellphone=cellphone,
            delete_url=MANAGEMENT_CELLPHONE_DELETE_URL,
        )
    def get(self):
        the_get = Get()
        instance = OHHOPermission()
        group_id = the_get.get_id(self)
        message = the_get.get_data(self)
        group_name = ""
        if group_id:
            group_id = int(group_id)
            group = instance.group.get_by_id(group_id)
            if group:
                group_name = group.name

        all_page = instance.page.get_query()
        page_ids = [p.id for p in all_page] if all_page else []

        query_group_and_page = instance.group_and_page.get_query()
        query_group_and_page = instance.group_and_page.get_by_group_id(
            query_group_and_page, group_id)
        permission_ids = [p.page_permission_id for p in query_group_and_page
                          ] if query_group_and_page else []

        query_page_permission = instance.page_permission.get_query()
        query_page_permission = instance.page_permission.get_by_page_permission_ids(
            query_page_permission, permission_ids)
        permission_page_ids = [q.page_id for q in query_page_permission
                               ] if query_page_permission else []

        the_page_ids = OHHOOperation.list_minus_list(page_ids,
                                                     permission_page_ids)
        rest_page_list = list()
        for page_id in the_page_ids:
            page = instance.page.get_by_id(page_id)
            temp = dict()
            if page:
                temp["page_id"] = page.id
                temp["page_description"] = page.description
                temp["page_name"] = page.name
            if temp:
                rest_page_list.append(temp)

        return self.render(
            PERMISSION_GROUP_PAGE_RELATION_BACKSTAGE_ADD_HTML,
            group_id=group_id,
            rest_page_list=rest_page_list,
            group_name=group_name,
            home_list_url=MANAGEMENT_PERMISSION_HOME_URL,
            list_url=PERMISSION_GROUP_PAGE_RELATION_BACKSTAGE_LIST_URL +
            "?id=" + str(group_id),
            detail_url=PERMISSION_GROUP_PAGE_RELATION_BACKSTAGE_DETAIL_URL,
            add_url=PERMISSION_GROUP_PAGE_RELATION_BACKSTAGE_ADD_URL + "?id=" +
            str(group_id),
            delete_url=PERMISSION_GROUP_PAGE_RELATION_BACKSTAGE_DELETE_URL,
            message=message)
Example #25
0
    def get(self):
        the_get = Get()
        instance = MatchLabel()
        match_label_id = the_get.get_id(self)
        match_label = instance.get_by_id(match_label_id)
        match_label_dict = instance.get_information(match_label)

        return self.render(BASE_MATCH_LABEL_DETAIL_HTML,
                           label=match_label_dict,
                           match_label_id=match_label_id,
                           detail_url=BASE_MATCH_LABEL_DETAIL_URL,
                           list_url=BASE_MATCH_LABEL_LIST_URL)
    def get(self):
        the_request = Get()
        self.set_format(the_request.get_format(self))
        user_id = the_request.get_user_id(self)
        base_url = the_request.get_base_url(self)

        user = User()
        data = user.get_basic_user_information(user_id, base_url)

        result = Result.result_success()
        result["data"] = data
        return self.response(result)
Example #27
0
 def get(self):
     the_get = Get()
     page_id = the_get.get_id(self)
     instance = OHHOPermission()
     if page_id:
         page_obj = instance.page.get_by_id(page_id)
     return self.render(PERMISSION_PAGE_BACKSTAGE_DELETE_HTML,
                        page_obj=page_obj,
                        detail_url=PERMISSION_PAGE_BACKSTAGE_DETAIL_URL,
                        delete_url=PERMISSION_PAGE_BACKSTAGE_DELETE_URL,
                        list_url=PERMISSION_PAGE_BACKSTAGE_LIST_URL
                        )
Example #28
0
    def get(self):
        instance = UserDisplayConfiguration()
        the_get = Get()
        userDisplayConfig_id = the_get.get_id(self)
        query_obj = ""
        if userDisplayConfig_id:
            query_obj = instance.get(userDisplayConfig_id)

        return self.render(BASE_USER_DISPLAY_CONFIG_DETAIL_HTML,
                           detail_url=BASE_USER_DISPLAY_CONFIG_DETAIL_URL,
                           list_url=BASE_USER_DISPLAY_CONFIG_LIST_URL,
                           query_obj=query_obj)
Example #29
0
 def get(self):
     instance = User()
     the_get = Get()
     username = the_get.get_username(self)
     if username:
         user = instance.get_by_username(username)
         if user:
             return self.write("false")
         else:
             return self.write("true")
     return self.render(BACKSTAGE_REGISTER_HTML,
                        postUrl=BACKSTAGE_REGISTER_URL,
                        msg="")
    def get(self):
        the_get = Get()
        instance = MatchCondition()
        match_condition_id = the_get.get_id(self)
        match_condition = instance.get_by_id(match_condition_id)
        match_condition_dict = instance.get_information(match_condition)

        return self.render(BASE_MATCH_CONDITION_DETAIL_HTML,
                           condition=match_condition_dict,
                           match_condition_id=match_condition_id,
                           detail_url=BASE_MATCH_CONDITION_DETAIL_URL,
                           list_url=BASE_MATCH_CONDITION_LIST_URL
                           )