Ejemplo n.º 1
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()
        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)
    def get(self):
        the_get = Get()
        permission = OHHOPermission()
        group_id = the_get.get_group_id(self)
        group = permission.group.get_by_id(group_id)
        group_name = group.name if group else ""
        page_name = the_get.get_page_name(self)
        page_permission_id = int(the_get.get_page_permission_id(self))
        insert = the_get.get_insert(self)
        insert = int(insert) if insert else 0
        delete = the_get.get_delete(self)
        delete = int(delete) if delete else 0
        update = the_get.get_update(self)
        update = int(update) if update else 0
        select = the_get.get_select(self)
        select = int(select) if select else 0
        message = the_get.get_data(self)

        return self.render(PERMISSION_GROUP_PAGE_RELATION_BACKSTAGE_DELETE_HTML,
                           page_name=page_name,
                           page_permission_id=page_permission_id,
                           insert=insert,
                           delete=delete,
                           update=update,
                           select=select,
                           group_id=group_id,
                           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 + "?page_permission_id=%d&data=%s&page_name=%s&insert=%d&delete=%d&update=%d&select=%d&group_id=%d" % (
                               int(page_permission_id), message, page_name, int(insert), int(delete), int(update),
                               int(select),
                               int(group_id)),
                           add_url=PERMISSION_GROUP_PAGE_RELATION_BACKSTAGE_ADD_URL + "?group_id=" + str(group_id),
                           delete_url=PERMISSION_GROUP_PAGE_RELATION_BACKSTAGE_DELETE_URL + "?page_permission_id=%d&data=%s&page_name=%s&insert=%d&delete=%d&update=%d&select=%d&group_id=%d" % (
                               int(page_permission_id), message, page_name, int(insert), int(delete), int(update),
                               int(select),
                               int(group_id)),
                           message=message
                           )
Ejemplo n.º 4
0
 def get(self):
     the_get = Get()
     message = the_get.get_data(self)
     if self.current_user:
         return self.redirect("/backstage/home/")
     return self.render("backstage/login.html", message=message)