1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-07 01:41:39 +00:00

update multi storages backend

1. use $.isEmptyObject() check if app.pageOptions.storages is empty
2. return [] if no storage_ids setting for user role
This commit is contained in:
lian
2018-04-13 13:27:05 +08:00
parent 12963cb7ef
commit 488c8802a3
4 changed files with 5 additions and 5 deletions

View File

@@ -13,6 +13,7 @@
</select> </select>
<br/> <br/>
<% } %> <% } %>
<% if (!$.isEmptyObject(app.pageOptions.storages)) { %>
<% if (app.pageOptions.storages.length > 1) { %> <% if (app.pageOptions.storages.length > 1) { %>
<label for="storage">{% trans "Storage backend"%}</label><br/> <label for="storage">{% trans "Storage backend"%}</label><br/>
<select name="storage" id="storage" class="select"> <select name="storage" id="storage" class="select">
@@ -27,6 +28,7 @@
</select> </select>
<br/> <br/>
<% } %> <% } %>
<% } %>
<% if (showSharePerm) { %> <% if (showSharePerm) { %>
<label for="share-permission">{% trans "Share Permission" %}</label><br /> <label for="share-permission">{% trans "Share Permission" %}</label><br />
<select id="share-permission" name="permission" class="select"> <select id="share-permission" name="permission" class="select">
@@ -1613,8 +1615,8 @@
<th width="14%"><span class="sr-only">{% trans "Actions" %}</span></th> <th width="14%"><span class="sr-only">{% trans "Actions" %}</span></th>
<% if (app.pageOptions.storages.length > 0) { %> <% if (app.pageOptions.storages.length > 0) { %>
<th width="10%">{% trans "Size" %}</th> <th width="10%">{% trans "Size" %}</th>
<th width="20%">{% trans "Storage backend" %}</th> <th width="15%">{% trans "Storage backend" %}</th>
<th width="10%"><a class="table-sort-op by-time" href="#">{% trans "Last Update" %} <span class="sort-icon icon-caret-up"></span></a></th> <th width="15%"><a class="table-sort-op by-time" href="#">{% trans "Last Update" %} <span class="sort-icon icon-caret-up"></span></a></th>
<% } else { %> <% } else { %>
<th width="20%">{% trans "Size" %}</th> <th width="20%">{% trans "Size" %}</th>
<th width="20%"><a class="table-sort-op by-time" href="#">{% trans "Last Update" %} <span class="sort-icon icon-caret-up"></span></a></th> <th width="20%"><a class="table-sort-op by-time" href="#">{% trans "Last Update" %} <span class="sort-icon icon-caret-up"></span></a></th>

View File

@@ -99,7 +99,7 @@ def get_library_storages(request):
elif STORAGE_CLASS_MAPPING_POLICY == 'ROLE_BASED': elif STORAGE_CLASS_MAPPING_POLICY == 'ROLE_BASED':
user_role_storage_ids = request.user.permissions.storage_ids() user_role_storage_ids = request.user.permissions.storage_ids()
if not user_role_storage_ids: if not user_role_storage_ids:
return all_storages return []
user_role_storages = [] user_role_storages = []
for user_role_storage_id in user_role_storage_ids: for user_role_storage_id in user_role_storage_ids:

View File

@@ -13,7 +13,6 @@ define([
return { return {
showSharePerm: true, showSharePerm: true,
enable_encrypted_library: app.pageOptions.enable_encrypted_library, enable_encrypted_library: app.pageOptions.enable_encrypted_library,
storages: app.pageOptions.storages,
library_templates: app.pageOptions.library_templates library_templates: app.pageOptions.library_templates
}; };
}, },

View File

@@ -13,7 +13,6 @@ define([
return { return {
showSharePerm: true, showSharePerm: true,
enable_encrypted_library: app.pageOptions.enable_encrypted_library, enable_encrypted_library: app.pageOptions.enable_encrypted_library,
storages: app.pageOptions.storages,
library_templates: app.pageOptions.library_templates library_templates: app.pageOptions.library_templates
}; };
}, },