Use ProjectResource class for sub-projects

This commit is contained in:
karel.picman@lbcfree.net 2020-10-06 15:09:34 +02:00
parent 25dc88c5e2
commit 7f93a95743
2 changed files with 7 additions and 7 deletions

View File

@ -120,7 +120,7 @@ module RedmineDmsf
new_path = new_path + '/' unless new_path[-1,1] == '/'
new_path = '/' + new_path unless new_path[0,1] == '/'
new_path += project_display_name
@__proxy.class.new new_path, request, response, @options.merge(user: @user)
@__proxy.class.new new_path, request, response, @options.merge(user: @user, project: true)
end
def parent

View File

@ -34,19 +34,19 @@ module RedmineDmsf
attr_reader :read_only
def initialize(*args)
def initialize(path, request, response, options)
# Return 404 - NotFound if WebDAV is not enabled
unless Setting.plugin_redmine_dmsf['dmsf_webdav']
raise NotFound
end
super *args
super path, request, response, options
pinfo = path.split('/').drop(1)
if pinfo.length == 0 # If this is the base_path, we're at root
@resource_c = IndexResource.new(*args)
elsif pinfo.length == 1 # This is the first level, and as such, project path
@resource_c = ProjectResource.new(*args)
@resource_c = IndexResource.new(path, request, response, options)
elsif (pinfo.length == 1) || options[:project] # The first level or we know that it's a project
@resource_c = ProjectResource.new(path, request, response, options)
else # We made it all the way to DMSF Data
@resource_c = DmsfResource.new(*args)
@resource_c = DmsfResource.new(path, request, response, options)
end
@resource_c.accessor = self if @resource_c
@read_only = Setting.plugin_redmine_dmsf['dmsf_webdav_strategy'] == 'WEBDAV_READ_ONLY'