-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
增加下载的权限(hhyo#1367) #1369
增加下载的权限(hhyo#1367) #1369
Changes from 3 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -265,6 +265,7 @@ <h4 class="modal-title text-danger">收藏语句</h4> | |
<script> | ||
//获取查询列表 | ||
function get_querylog(query_log_id) { | ||
var showExport = {{is_download}}==1 | ||
//初始化table | ||
$('#sql-log').bootstrapTable('destroy').bootstrapTable({ | ||
escape: true, | ||
|
@@ -280,7 +281,7 @@ <h4 class="modal-title text-danger">收藏语句</h4> | |
pageNumber: 1, //初始化加载第一页,默认第一页,并记录 | ||
pageSize: 14, //每页的记录行数(*) | ||
pageList: [10, 30, 50, 100], //可供选择的每页的行数(*) | ||
showExport: true, //是否显示导出按钮 | ||
showExport: showExport, //是否显示导出按钮 | ||
exportTypes: ['json', 'sql', 'csv', 'txt', 'xml', 'xlsx'], | ||
exportOptions: { | ||
ignoreColumn: [0], //忽略某些列的索引数组 | ||
|
@@ -781,11 +782,12 @@ <h4 class="modal-title text-danger">收藏语句</h4> | |
if (optgroup == 'Mongo') { | ||
isdetail = true | ||
} | ||
var showExport = {{is_download}}==1 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 三个等于号? |
||
$("#" + ('query_result' + n)).bootstrapTable('destroy').bootstrapTable({ | ||
escape: true, | ||
data: result['rows'], | ||
columns: columns, | ||
showExport: true, | ||
showExport: showExport, | ||
exportDataType: "all", | ||
exportTypes: ['json', 'sql', 'csv', 'txt', 'xml', 'xlsx'], | ||
exportOptions: { | ||
|
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -220,7 +220,8 @@ def sqlquery(request): | |||||
# 收藏语句 | ||||||
user = request.user | ||||||
favorites = QueryLog.objects.filter(username=user.username, favorite=True).values('id', 'alias') | ||||||
return render(request, 'sqlquery.html', {'favorites': favorites}) | ||||||
is_download = 1 if user.has_perm('sql.download') or user.is_superuser else 0 | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
变量改成 can_download 更精准一点 |
||||||
return render(request, 'sqlquery.html', {'favorites': favorites, 'is_download':is_download}) | ||||||
|
||||||
|
||||||
@permission_required('sql.menu_queryapplylist', raise_exception=True) | ||||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,4 +23,9 @@ alter table audit_log add `user_display` varchar(50) DEFAULT NULL COMMENT '用 | |
|
||
set @content_type_id=(select id from django_content_type where app_label='sql' and model='permission'); | ||
insert IGNORE INTO auth_permission (name, content_type_id, codename) VALUES | ||
('审计权限 ', @content_type_id, 'audit_user'); | ||
('审计权限', @content_type_id, 'audit_user'); | ||
|
||
-- 在线查询下载权限 | ||
set @content_type_id=(select id from django_content_type where app_label='sql' and model='permission'); | ||
insert IGNORE INTO auth_permission (name, content_type_id, codename) VALUES | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 建议逻辑保持一致,给默认用户组授予权限,不需要的可以主动剔除 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. -- 默认组拥有在线查询下载权限
insert into auth_group_permissions (group_id, permission_id) select 1,id from auth_permission where
name='在线查询下载权限' and content_type_id=@content_type_id and codename='query_download'; 添加这样语句? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 对,不过也不一定用户都是用的这个默认组,不好确认,后续这边在release note中说明下好了 |
||
('在线查询下载权限', @content_type_id, 'download'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
query_download ,你觉得这个名字怎么样