WebDav Project Display #271

This commit is contained in:
Karel Pičman 2014-09-18 14:45:52 +02:00
parent 658a54d074
commit 57c9fb5dfa
3 changed files with 13 additions and 13 deletions

View File

@ -1,6 +1,6 @@
# Redmine plugin for Document Management System "Features"
#
# Copyright (C) 2012 Daniel Munn <dan.munn@munnster.co.uk>
# Copyright (C) 2012 Daniel Munn <dan.munn@munnster.co.uk>
# Copyright (C) 2011-14 Karel Picman <karel.picman@kontron.com>
#
# This program is free software; you can redistribute it and/or
@ -66,8 +66,8 @@ module RedmineDmsf
# - 2012-06-15: Only if you're allowed to browse the project
# - 2012-06-18: Issue #5, ensure item is only listed if project is enabled for dmsf
def exist?
return false if project.nil? || project.module_enabled?('dmsf').nil? || !(folder? || file?)
User.current.admin? ? true : User.current.allowed_to?(:view_dmsf_folders, project)
return false if project.nil? || !project.module_enabled?('dmsf') || !(folder? || file?)
User.current.admin? || User.current.allowed_to?(:view_dmsf_folders, project)
end
# is this entity a folder?
@ -212,7 +212,7 @@ module RedmineDmsf
# - 2012-06-18: Ensure item is only functional if project is enabled for dmsf
def make_collection
if (request.body.read.to_s == '')
raise NotFound if project.nil? || project.id.nil? || project.module_enabled?('dmsf').nil?
raise NotFound if project.nil? || project.id.nil? || !project.module_enabled?('dmsf')
raise Forbidden unless User.current.admin? || User.current.allowed_to?(:folder_manipulation, project)
return MethodNotAllowed if exist? #If we already exist, why waste the time trying to save?
parent_folder = nil

View File

@ -1,6 +1,7 @@
# Redmine plugin for Document Management System "Features"
#
# Copyright (C) 2012 Daniel Munn <dan.munn@munnster.co.uk>
# Copyright (C) 2012 Daniel Munn <dan.munn@munnster.co.uk>
# Copyright (C) 2011-14 Karel Picman <karel.picman@kontron.com>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
@ -34,7 +35,7 @@ module RedmineDmsf
User.current.memberships.each {|m| @Projects << m.project if m.roles.detect {|r| r.allowed_to?(:view_dmsf_folders)}}
end
end
@Projects.delete_if { |node| node.module_enabled?('dmsf').nil? } unless @Projects.nil?
@Projects.delete_if { |node| !node.module_enabled?('dmsf') } unless @Projects.nil?
return [] if @Projects.nil? || @Projects.empty?
@Projects.map do |p|
child p.identifier

View File

@ -1,6 +1,7 @@
# Redmine plugin for Document Management System "Features"
#
# Copyright (C) 2012 Daniel Munn <dan.munn@munnster.co.uk>
# Copyright (C) 2012 Daniel Munn <dan.munn@munnster.co.uk>
# Copyright (C) 2011-14 Karel Picman <karel.picman@kontron.com>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
@ -36,14 +37,12 @@ module RedmineDmsf
@children.push child(p.name, p)
end
@children
end
end
# - 2012-06-18: Issue #5, ensure item is only listed if project is enabled for dmsf
def exist?
return false if (project.nil? || User.current.anonymous?)
return false if (project.module_enabled?('dmsf').nil?) #See Issue #5
return true if User.current.admin?
User.current.allowed_to?(:view_dmsf_folders, project)
return false if (project.nil? || User.current.anonymous?)
return false unless project.module_enabled?('dmsf')
User.current.admin? || User.current.allowed_to?(:view_dmsf_folders, project)
end
def collection?