Folder visible via webdav but not via UI #1163
This commit is contained in:
parent
fce6668ae2
commit
430f485998
@ -154,11 +154,20 @@ class DmsfQuery < Query
|
|||||||
order_option[1].gsub!(',', " #{$1},")
|
order_option[1].gsub!(',', " #{$1},")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
base_scope.
|
items = base_scope.
|
||||||
where(statement).
|
where(statement).
|
||||||
order(order_option).
|
order(order_option).
|
||||||
limit(options[:limit]).
|
limit(options[:limit]).
|
||||||
offset(options[:offset])
|
offset(options[:offset]).to_a
|
||||||
|
items.each do |item|
|
||||||
|
if item.type == 'folder'
|
||||||
|
dmsf_folder = DmsfFolder.find_by(id: item.id)
|
||||||
|
if dmsf_folder && (!DmsfFolder.permissions?(dmsf_folder, false))
|
||||||
|
items.delete item
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
items
|
||||||
end
|
end
|
||||||
|
|
||||||
def extra_columns
|
def extra_columns
|
||||||
|
|||||||
@ -49,8 +49,10 @@ module RedmineDmsf
|
|||||||
@children = []
|
@children = []
|
||||||
if folder
|
if folder
|
||||||
# Folders
|
# Folders
|
||||||
folder.dmsf_folders.visible.pluck(:title).each do |title|
|
folder.dmsf_folders.visible.each do |f|
|
||||||
@children.push child(title)
|
if DmsfFolder.permissions?(f, false)
|
||||||
|
@children.push child(f.title)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
# Files
|
# Files
|
||||||
folder.dmsf_files.visible.pluck(:name).each do |name|
|
folder.dmsf_files.visible.pluck(:name).each do |name|
|
||||||
@ -62,8 +64,10 @@ module RedmineDmsf
|
|||||||
if subproject.module_enabled?(:dmsf)
|
if subproject.module_enabled?(:dmsf)
|
||||||
# Folders
|
# Folders
|
||||||
if User.current.allowed_to?(:view_dmsf_folders, project)
|
if User.current.allowed_to?(:view_dmsf_folders, project)
|
||||||
subproject.dmsf_folders.visible.pluck(:title).each do |title|
|
subproject.dmsf_folders.visible.each do |f|
|
||||||
@children.push child(title)
|
if DmsfFolder.permissions?(f, false)
|
||||||
|
@children.push child(f.title)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
# Files
|
# Files
|
||||||
@ -95,6 +99,9 @@ module RedmineDmsf
|
|||||||
unless @folder
|
unless @folder
|
||||||
@folder = DmsfFolder.visible.find_by(project_id: project&.id, title: basename,
|
@folder = DmsfFolder.visible.find_by(project_id: project&.id, title: basename,
|
||||||
dmsf_folder_id: parent&.folder&.id)
|
dmsf_folder_id: parent&.folder&.id)
|
||||||
|
if @folder && (!DmsfFolder.permissions?(@folder, false))
|
||||||
|
@folder = nil
|
||||||
|
end
|
||||||
end
|
end
|
||||||
@folder
|
@folder
|
||||||
end
|
end
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user