mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-15 23:00:57 +00:00
update share link permission (#2328)
1, download Link -> Share link 2, add can_preview field for file when ajax list lib dir 3, hide preview-only permission if a file can not preview
This commit is contained in:
@@ -30,6 +30,7 @@ define([
|
||||
this.dirent_path = options.dirent_path;
|
||||
this.obj_name = options.obj_name;
|
||||
this.is_dir = options.is_dir;
|
||||
this.can_preview = options.can_preview;
|
||||
|
||||
// share to user/group
|
||||
var enable_dir_private_share = false;
|
||||
@@ -88,17 +89,21 @@ define([
|
||||
|
||||
// show 'can edit' perm option for download link or not
|
||||
var show_link_edit_perm_option = false;
|
||||
var show_link_preview_only_perm_option = true;
|
||||
var file_ext = '';
|
||||
if (!this.is_dir && this.obj_name.lastIndexOf('.') != -1) {
|
||||
file_ext = this.obj_name.substr(this.obj_name.lastIndexOf('.') + 1)
|
||||
.toLowerCase();
|
||||
}
|
||||
if (app.pageOptions.is_pro &&
|
||||
if (this.user_perm == 'rw' && !this.is_dir &&
|
||||
(app.pageOptions.enable_office_web_app ||
|
||||
app.pageOptions.enable_onlyoffice) &&
|
||||
(file_ext == 'docx' || file_ext == 'xlsx' || file_ext == 'pptx')) {
|
||||
show_link_edit_perm_option = true;
|
||||
}
|
||||
if (!this.is_dir && !this.can_preview) {
|
||||
show_link_preview_only_perm_option = false;
|
||||
}
|
||||
|
||||
this.$el.html(this.template({
|
||||
title: gettext("Share {placeholder}")
|
||||
@@ -110,6 +115,7 @@ define([
|
||||
show_admin_perm_option: show_admin_perm_option,
|
||||
|
||||
show_link_edit_perm_option: show_link_edit_perm_option,
|
||||
show_link_preview_only_perm_option: show_link_preview_only_perm_option,
|
||||
|
||||
user_perm: this.user_perm,
|
||||
repo_id: this.repo_id,
|
||||
|
Reference in New Issue
Block a user