def do_logic(self, req, res, session): self.jinja_html_file = 'jvn_account.j2' self.method = req.params['method'] #リクエストのパスワードとセッション情報のそれが同一の場合は変更しない。 jvn = session.get(get_session_key(req)) if req.params['passwd'] == jvn.passwd: hash_code = jvn.passwd else: hash_code = make_passwd(req.params['passwd']) def do_execute(db): rec = Account(req.params, hash_code) ret, self.error_message = rec.validate(db, self.method) if ret == False: self.jinja_html_file = 'jvn_account_edit.j2' self.ui = rec setPrivs(self, rec.privs) return if self.method == 'regist': db.add(rec) elif self.method == 'modify': rec = db.query(Account).filter_by( user_id=req.params['user_id']).first() rec.passwd = hash_code rec.user_name = req.params['user_name'] rec.email = req.params['email'] rec.department = req.params['department'] rec.privs = req.params['privs'] return db.query(Account).order_by(Account.user_id).all() self.result = do_transaction(do_execute, self)
def do_logic(self, req, res, session): self.title_name = 'JVN CWE別脆弱性件数' self.ui = session[get_session_key(req)] = JvnState() self.jinja_html_file = 'jvn_summary.j2' dao = JvnDAO(self) self.result = [( '<a href="%s/jvn_list/index?cweid=%s">%s</a>' % (self.topuri, rec[0], rec[1]), rec[2], ) for rec in dao.get_records()]
def do_logic(self, req, res, session): self.jinja_html_file = 'jvn_develop.j2' ui = session[get_session_key(req)] = JvnState(0) dao = JvnDAO(self) self.result = dao.get_edit_records() ui.total_count = len(self.result) # 戻るボタンを非表示にする self.backlink = None
def do_logic(self, req, res, session): self.jinja_html_file = 'jvn_ticket.j2' self.identifier = req.params['identifier'] ui = session[get_session_key(req)] = JvnState(0) dao = JvnDAO(self) self.result = [ x[0:4] + (fs_manage_code2ui(x[4]), ) for x in dao.get_all_records() ] ui.total_count = len(self.result)
def do_logic(self, req, res, session): self.jinja_html_file = 'jvn_account_edit.j2' self.ui = do_transaction( lambda db: db.query(Account).filter_by(user_id=req.params[ 'user_id']).first(), self) state = JvnState() state.passwd = self.ui.passwd session[get_session_key(req)] = state self.readonly = 'readonly' self.method = 'modify' setPrivs(self, self.ui.privs)
def do_logic(self, req, res, session): session[get_session_key(req)] = JvnState() self.jinja_html_file = 'jvn_account_edit.j2' self.ui = Account( { 'user_id': '', 'passwd': '', 'user_name': '', 'email': '', 'department': '', 'privs': '' }, '') self.readonly = '' self.method = 'regist' setPrivs(self, 'user')
def do_logic(self, req, res, session): self.jinja_html_file = 'jvn_ticket_complete.j2' self.identifier = req.params['identifier'] ui = session.get(get_session_key(req)) def do_execute(db): rec = db.query(Vulnerability).filter_by( identifier=self.identifier).first() rec.ticket_modified_date = datetime.datetime.now() do_transaction(do_execute, self) records = [] for i in range(0, ui.total_count): records.append((req.params["vname" + str(i + 1)], req.params["pname" + str(i + 1)], req.params["cpe" + str(i + 1)])) self.result = records
def do_chart(self, uri, req, session): self.title_name = 'JVN 脆弱性発生件数' url = req.host_url if 'cwe' in req.params: self.link_url = "/vms/jvn_" + uri + "/index" uri = 'cwe' + uri else: self.link_url = "/vms/jvn_" + uri + "/index?cwe=on" idx = url.rfind(':' + req.host_port) if idx == -1: p = url[0:url.find(':')] self.image_url = p + '://localhost' + ':' + self.config.get( 'plt', 'port') + '/' + uri else: self.image_url = url[0:idx] + ':' + self.config.get( 'plt', 'port') + '/' + uri self.ui = session[get_session_key(req)] = JvnState() self.jinja_html_file = 'jvn_chart.j2'
def core_proc(self, req, session, func): """スケルトンロジック """ # インスタンス変数の初期化 self.pager_app = get_session_key(req) self.result = () self.error_message = '' # sessionとrequestのマージ処理 self.make_ui(req, session) # 変数の初期化 self.initialize() # indexの場合は処理を行わない if (os.path.basename(req.path_qs) == 'index' and self.is_init_page() == False): return #最初のアクションの場合はトータル件数をセットする。 if self.is_init_page() == True: self.ui.set_count(self.dao.get_count()) # 検索結果がゼロの場合 if (self.ui.total_count == 0): self.error_message = '該当するレコードが存在しません。検索条件をチェックしてください。' self.ui.reset() return # 検索結果が上限値を超えた場合 if (self.ui.total_count > self.MAX_TOTAL_COUNT): self.error_message = '検索結果が上限値(%d)を超えました。検索条件をチェックしてください。' % ( self.MAX_TOTAL_COUNT) self.ui.total_count = 0 return func() self.result = self.dao.get_records(self.ui.page) self.ui.set_control_page_button(self.result)
def do_logic(self, req, res, session): self.jinja_html_file = 'jvn_operation_complete.j2' ui = session.get(get_session_key(req)) def do_execute(db): records = [] for i in range(0, ui.total_count): checkbox = "check" + str(i + 1) if checkbox in req.params: rec = db.query(Product).filter_by( cpe=req.params[checkbox]).first() rec.edit = 1 records.append((req.params["vname" + str(i + 1)], req.params["pname" + str(i + 1)], req.params[checkbox])) return records self.result = do_transaction(do_execute, self)
def do_logic(self, req, res, session): self.title_name = 'JVN 製品別脆弱性件数' self.ui = session[get_session_key(req)] = JvnState() self.jinja_html_file = 'jvn_summary.j2' dao = JvnDAO(self) self.result = dao.get_records()