Skip to content

Commit

Permalink
完善查询权限管理的问题说明
Browse files Browse the repository at this point in the history
权限管理只显示有效的权限信息
  • Loading branch information
hhyo committed Jun 13, 2018
1 parent 24133fb commit fe8e738
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 9 deletions.
10 changes: 7 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
* [功能集成](#其他功能集成)
* [在线查询&脱敏查询](#在线查询)
* [慢日志管理](#慢日志管理)
* [SQLAdvisor优化工具](#SQL优化工具)
* [SQL优化工具](#SQLAdvisor优化工具)
* [阿里云rds管理](#阿里云rds管理)
* [Q&A](#部分问题解决办法 )

Expand Down Expand Up @@ -150,7 +150,7 @@
3. 使用src/script/mysql_slow_query_review.sql创建慢日志收集表到archer数据库
4. 将src/script/analysis_slow_query.sh部署到各个监控机器,注意修改脚本里面的 `hostname="${mysql_host}:${mysql_port}" `与archer主库配置信息一致,否则将无法筛选到相关记录
### SQL优化工具
### SQLAdvisor优化工具
1. 安装SQLAdvisor,[项目地址](https://github.com/Meituan-Dianping/SQLAdvisor)
2. 修改配置文件SQLADVISOR为程序路径,路径需要完整,如'/opt/SQLAdvisor/sqladvisor/sqladvisor'
Expand Down Expand Up @@ -221,7 +221,6 @@ archer会默认过滤一些系统数据库,过滤列表为`'information_schema
- 审核通过后没有执行按钮
archer的SQL上线流程为:工程师提交SQL->审核人审核->DBA执行,审核人只能审核归属自己审核的数据,DBA执行全部数据
#### 检测SQL报错
- **invalid literal for int() with base 10:'Inception2'**
调整pymysql使其兼容Inception版本信息,
Expand Down Expand Up @@ -251,6 +250,11 @@ inception无法连接备份库
- 检查DML的表是否存在主键
- 检查语句是否有影响数据
#### 查询权限管理
- 查询权限管理的审批流程和SQL上线是隔离的,需要到后台数据管理进行配置
- 审核人看不到待审核工单
代办列表被隐藏至右上角的消息图标中,当有待审核信息是会显示图标,可以进入查看待办数据
#### 定时任务
- 未执行
检查django-apscheduler相关表是否有创建,可使用`python3 manage.py migrate`创建
Expand Down
12 changes: 8 additions & 4 deletions sql/query.py
Original file line number Diff line number Diff line change
Expand Up @@ -491,15 +491,19 @@ def getuserprivileges(request):
if loginUserOb.is_superuser == 1 or loginUserOb.role == 'DBA':
if user_name != 'all':
privilegeslist = QueryPrivileges.objects.all().filter(user_name=user_name, is_deleted=0,
table_name__contains=search).order_by(
table_name__contains=search,
valid_date__gte=datetime.datetime.now()).order_by(
'-privilege_id')[offset:limit]
privilegeslistCount = QueryPrivileges.objects.all().filter(user_name=user_name, is_deleted=0,
table_name__contains=search).count()
table_name__contains=search,
valid_date__gte=datetime.datetime.now()).count()
else:
privilegeslist = QueryPrivileges.objects.all().filter(is_deleted=0, table_name__contains=search).order_by(
privilegeslist = QueryPrivileges.objects.all().filter(is_deleted=0, table_name__contains=search,
valid_date__gte=datetime.datetime.now()).order_by(
'-privilege_id')[offset:limit]
privilegeslistCount = QueryPrivileges.objects.all().filter(is_deleted=0,
table_name__contains=search).count()
table_name__contains=search,
valid_date__gte=datetime.datetime.now()).count()
else:
privilegeslist = QueryPrivileges.objects.filter(user_name=loginUserOb.username, is_deleted=0).filter(
table_name__contains=search).order_by('-privilege_id')[offset:limit]
Expand Down
4 changes: 2 additions & 2 deletions sql/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -556,8 +556,8 @@ def diagnosis_process(request):
loginUser = request.session.get('login_username', False)
loginUserOb = users.objects.get(username=loginUser)

# 获取所有集群名称
masters = AliyunRdsConfig.objects.all().order_by('cluster_name')
# 获取所有实例名称
masters = master_config.objects.all().order_by('cluster_name')
cluster_name_list = [master.cluster_name for master in masters]

context = {'currentMenu': 'diagnosis', 'tab': 'process', 'cluster_name_list': cluster_name_list,
Expand Down

0 comments on commit fe8e738

Please sign in to comment.