mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-09-14 00:54:32 +08:00
Fix shared locations perimission in move modal [SCI-11117]
This commit is contained in:
parent
2fb5b573c6
commit
1a9a3bdad8
2 changed files with 11 additions and 3 deletions
|
@ -123,7 +123,7 @@ class StorageLocationsController < ApplicationController
|
|||
end
|
||||
|
||||
def tree
|
||||
records = current_team.storage_locations.where(parent: nil, container: [false, params[:container] == 'true'])
|
||||
records = StorageLocation.viewable_by_user(current_user, current_team).where(parent: nil, container: [false, params[:container] == 'true'])
|
||||
render json: storage_locations_recursive_builder(records)
|
||||
end
|
||||
|
||||
|
@ -253,6 +253,7 @@ class StorageLocationsController < ApplicationController
|
|||
storage_locations.map do |storage_location|
|
||||
{
|
||||
storage_location: storage_location,
|
||||
can_manage: (can_manage_storage_location?(storage_location) unless storage_location.parent_id),
|
||||
children: storage_locations_recursive_builder(
|
||||
storage_location.storage_locations.where(container: [false, params[:container] == 'true'])
|
||||
)
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
:class="{
|
||||
'!bg-sn-super-light-blue': storageLocationTree.storage_location.id == value,
|
||||
'text-sn-blue cursor-pointer hover:bg-sn-super-light-grey': (
|
||||
moveMode === 'locations' || storageLocationTree.storage_location.container
|
||||
(moveMode === 'locations' || storageLocationTree.storage_location.container) && managePermission(storageLocationTree)
|
||||
)
|
||||
}">
|
||||
<i v-if="storageLocationTree.storage_location.container" class="sn-icon sn-icon-item"></i>
|
||||
|
@ -25,6 +25,7 @@
|
|||
<MoveTree v-if="opendedStorageLocations[storageLocationTree.storage_location.id]"
|
||||
:storageLocationsTree="storageLocationTree.children"
|
||||
:value="value"
|
||||
:canManage="managePermission(storageLocationTree)"
|
||||
:moveMode="moveMode"
|
||||
@selectStorageLocation="$emit('selectStorageLocation', $event)" />
|
||||
</div>
|
||||
|
@ -37,7 +38,8 @@ export default {
|
|||
props: {
|
||||
storageLocationsTree: Array,
|
||||
value: Number,
|
||||
moveMode: String
|
||||
moveMode: String,
|
||||
canManage: Boolean
|
||||
},
|
||||
components: {
|
||||
MoveTree: () => import('./move_tree.vue')
|
||||
|
@ -49,9 +51,14 @@ export default {
|
|||
},
|
||||
methods: {
|
||||
selectStorageLocation(storageLocationTree) {
|
||||
if (!this.managePermission(storageLocationTree)) return;
|
||||
|
||||
if (this.moveMode === 'locations' || storageLocationTree.storage_location.container) {
|
||||
this.$emit('selectStorageLocation', storageLocationTree.storage_location.id);
|
||||
}
|
||||
},
|
||||
managePermission(loc) {
|
||||
return loc.storage_location.parent_id ? this.canManage : loc.can_manage;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Add table
Reference in a new issue