mirror of https://github.com/tp4a/teleport
修正:审计授权处理不当。
parent
396312ece1
commit
3e9809c726
|
@ -671,7 +671,7 @@ class DatabaseInit:
|
|||
)
|
||||
|
||||
def _create_syslog(self):
|
||||
""" 操作日志(用户登录、授权等等WEB上的操作) """
|
||||
""" 系统日志(用户登录、授权等等WEB上的操作) """
|
||||
f = list()
|
||||
|
||||
# id: 自增主键
|
||||
|
@ -698,28 +698,6 @@ class DatabaseInit:
|
|||
'CREATE TABLE `{}syslog` ({});'.format(self.db.table_prefix, ','.join(f))
|
||||
)
|
||||
|
||||
# def _create_sys_state(self):
|
||||
# """ 系统运行状态记录,用于dashboard页面展示
|
||||
# 系统每5分钟记录一次当前cpu负载/磁盘IO负载/网络IO负载/远程连接数,用来显示曲线图
|
||||
# 然后系统定时每天做一次清理操作,将超过30天的数据清除掉
|
||||
# """
|
||||
# f = list()
|
||||
#
|
||||
# # id: 自增主键
|
||||
# f.append('`id` integer PRIMARY KEY {}'.format(self.db.auto_increment))
|
||||
#
|
||||
# # type 数据类型:1=cpu, 2=disk-io, 3=net-io, 4=remote-count
|
||||
# f.append('`type` int(11) DEFAULT 0')
|
||||
# # val: 记录的值
|
||||
# f.append('`val` int(11) DEFAULT 0')
|
||||
# # ts: 记录时间
|
||||
# f.append('`ts` int(11) DEFAULT 0')
|
||||
#
|
||||
# self._db_exec(
|
||||
# '创建系统运行状态记录表...',
|
||||
# 'CREATE TABLE `{}sys_state` ({});'.format(self.db.table_prefix, ','.join(f))
|
||||
# )
|
||||
|
||||
def _create_record(self):
|
||||
""" 运维录像日志 """
|
||||
f = list()
|
||||
|
|
|
@ -35,13 +35,14 @@ def get_records(handler, sql_filter, sql_order, sql_limit, sql_restrict, sql_exc
|
|||
allow_uid = user.id
|
||||
if (user['privilege'] & TP_PRIVILEGE_AUDIT) != 0:
|
||||
s = SQL(get_db())
|
||||
s.select_from('audit_map', ['h_id'], alt_name='a')
|
||||
s.select_from('audit_map', ['u_id', 'h_id', 'p_state', 'policy_auth_type', 'u_state', 'gu_state'], alt_name='a')
|
||||
s.where(
|
||||
'a.u_id={user_id} AND '
|
||||
'a.p_state={enable_state} AND'
|
||||
'('
|
||||
'((a.policy_auth_type={U2H} OR a.policy_auth_type={U2HG}) AND a.u_state={enable_state}) OR '
|
||||
'((a.policy_auth_type={UG2H} OR a.policy_auth_type={UG2HG}) AND a.u_state={enable_state} AND a.gu_state={enable_state})'
|
||||
')'.format(enable_state=TP_STATE_NORMAL, U2H=TP_POLICY_AUTH_USER_HOST, U2HG=TP_POLICY_AUTH_USER_gHOST, UG2H=TP_POLICY_AUTH_gUSER_HOST, UG2HG=TP_POLICY_AUTH_gUSER_gHOST))
|
||||
')'.format(enable_state=TP_STATE_NORMAL, user_id=user.id, U2H=TP_POLICY_AUTH_USER_HOST, U2HG=TP_POLICY_AUTH_USER_gHOST, UG2H=TP_POLICY_AUTH_gUSER_HOST, UG2HG=TP_POLICY_AUTH_gUSER_gHOST))
|
||||
err = s.query()
|
||||
if err != TPE_OK:
|
||||
return err, 0, []
|
||||
|
|
Loading…
Reference in New Issue