Merge branch 'devel-1.4.5' of https://github.com/danmunn/redmine_dmsf into devel-1.4.5

This commit is contained in:
Daniel Munn 2012-07-11 10:08:59 +02:00
commit 712a7b3c86
5 changed files with 39 additions and 6 deletions

View File

@ -1,6 +1,10 @@
Changelog for Redmine DMSF
==========================
1.4.5: *Not yet released*
-----------------------
* New: Settings introduced to enable read-only or read-write stance to be taken with webdav
1.4.4p2: *2012-07-08*
-------------------
* Fix: Issue #22 - Webdav upload with passenger/nginx fails with server error (passenger class for request.body does not contain length method.

View File

@ -91,9 +91,22 @@
(<%=l(:label_default)%>: <%=l(:select_option_activated)%>)
<br/>
<%= l(:note_webdav).html_safe %>
</p>
<% if @settings["dmsf_webdav"].nil? || !@settings["dmsf_webdav"].empty? %>
<p>
<%=content_tag(:label, l(:label_webdav_strategy) + ":") %>
<%=select_tag("settings[dmsf_webdav_strategy]",
options_for_select([
[l(:select_option_webdav_readonly), "WEBDAV_READ_ONLY"],
[l(:select_option_webdav_readwrite), "WEBDAV_READ_WRITE"]],
:selected => @settings["dmsf_webdav_strategy"])) %><br/>
(<%=l(:label_default)%>: <%=l(:select_option_webdav_readonly)%>)
<br/>
<%= l(:note_webdav_strategy).html_safe %>
</p>
<% end %>
<hr />
<% begin

View File

@ -203,4 +203,7 @@ en:
:title_unlock_folder: "Unlock to allow changes for other members"
:title_lock_folder: "Lock to prevent changes for other members"
:select_option_webdav_readonly: "Read-only"
:select_option_webdav_readwrite: "Read/Write"
:label_webdav_strategy: "Webdav strategy"
:note_webdav_strategy: "Enables the administrator to decide if webdav is a read-only or read-write platform for end users."

View File

@ -24,7 +24,7 @@ Redmine::Plugin.register :redmine_dmsf do
name "DMSF"
author "Vit Jonas / Daniel Munn"
description "Document Management System Features"
version "1.4.4p2 stable"
version "1.4.5 devel"
url "https://github.com/danmunn/redmine_dmsf"
author_url "https://code.google.com/p/redmine-dmsf/"

View File

@ -27,6 +27,21 @@ module RedmineDmsf
@folder = false
end
#Here we make sure our folder and file methods are not aliased - it should shave a few cycles off of processing
def setup
@skip_alias |= [ :folder, :file, :folder?, :file? ]
end
# Here we hook into the fact that resources can have a pre-execution routine run for them
# Our sole job here is to ensure that any write functionality is restricted to relevent configuration
before do |resource, method_name|
#If our method is not one of the following, there is no point continuing.
if [ :put, :make_collection, :move, :copy, :delete, :lock, :unlock, :set_property ].include?(method_name)
webdav_setting = Setting.plugin_redmine_dmsf["dmsf_webdav_strategy"]
webdav_setting = "WEBDAV_READ_ONLY" if webdav_setting.nil?
raise BadGateway if webdav_setting == "WEBDAV_READ_ONLY"
end
end
# Gather collection of objects that denote current entities child entities
# Used for listing directories etc, implemented basic caching because otherwise
@ -189,7 +204,7 @@ module RedmineDmsf
end
OK
end
# Process incoming MKCOL request
#
# Create a DmsfFolder at location requested, only if parent is a folder (or root)
@ -548,8 +563,6 @@ module RedmineDmsf
%w(creationdate displayname getlastmodified getetag resourcetype getcontenttype getcontentlength supportedlock lockdiscovery)
end
private
# Prepare file for download using Rack functionality:
# Download (see RedmineDmsf::Webdav::Download) extends Rack::File to allow single-file