Delete documents configuration works for all the roles #336

This commit is contained in:
Karel Pičman 2015-01-21 14:04:55 +01:00
parent 8da9325da2
commit e26a84faa7
3 changed files with 18 additions and 9 deletions

View File

@ -1,8 +1,10 @@
# encoding: utf-8
#
# Redmine plugin for Document Management System "Features"
#
# Copyright (C) 2011 Vít Jonáš <vit.jonas@gmail.com>
# Copyright (C) 2012 Daniel Munn <dan.munn@munnster.co.uk>
# Copyright (C) 2011-14 Karel Pičman <karel.picman@kontron.com>
# Copyright (C) 2011-15 Karel Pičman <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
@ -35,7 +37,8 @@ class DmsfController < ApplicationController
def show
@folder_manipulation_allowed = User.current.allowed_to?(:folder_manipulation, @project)
@file_manipulation_allowed = User.current.allowed_to?(:file_manipulation, @project)
@file_delete_allowed = User.current.allowed_to?(:file_delete, @project)
@file_delete_allowed = User.current.allowed_to?(:file_delete, @project)
@file_view_allowed = User.current.allowed_to?(:view_dmsf_files, @project)
@force_file_unlock_allowed = User.current.allowed_to?(:force_file_unlock, @project)
@workflows_available = DmsfWorkflow.where(['project_id = ? OR project_id IS NULL', @project.id]).count > 0
@file_approval_allowed = User.current.allowed_to?(:file_approval, @project)

View File

@ -1,9 +1,11 @@
<%#=
# encoding: utf-8
#
# Redmine plugin for Document Management System "Features"
#
# Copyright (C) 2011 Vít Jonáš <vit.jonas@gmail.com>
# Copyright (C) 2012 Daniel Munn <dan.munn@munnster.co.uk>
# Copyright (C) 2011-14 Karel Pičman <karel.picman@kontron.com>
# Copyright (C) 2011-15 Karel Pičman <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
@ -107,9 +109,9 @@
:class => 'dmfs_entries', :id => 'entries_form') do %>
<%= hidden_field_tag('action') %>
<div class="controls" style="float: left">
<%= submit_tag(l(:button_download), :title => l(:title_download_checked), :name => 'download_entries') %>
<%= submit_tag(l(:field_mail), :title => l(:title_send_checked_by_email), :name => 'email_entries') %>
<%= submit_tag(l(:button_delete), :title => l(:title_delete_checked), :name => 'delete_entries') %>
<%= submit_tag(l(:button_download), :title => l(:title_download_checked), :name => 'download_entries') if @file_view_allowed %>
<%= submit_tag(l(:field_mail), :title => l(:title_send_checked_by_email), :name => 'email_entries') if @file_view_allowed %>
<%= submit_tag(l(:button_delete), :title => l(:title_delete_checked), :name => 'delete_entries') if @file_delete_allowed %>
</div>
<% values = @folder ? @folder.custom_field_values : @parent ? @parent.custom_field_values : DmsfFolder.new(:project => @project).custom_field_values %>
<% unless values.empty? %>

10
init.rb
View File

@ -1,8 +1,10 @@
# encoding: utf-8
#
# Redmine plugin for Document Management System "Features"
#
# Copyright (C) 2011 Vít Jonáš <vit.jonas@gmail.com>
# Copyright (C) 2012 Daniel Munn <dan.munn@munnster.co.uk>
# Copyright (C) 2011-14 Karel Picman <karel.picman@kontron.com>
# Copyright (C) 2011-15 Karel Pičman <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
@ -69,13 +71,15 @@ Redmine::Plugin.register :redmine_dmsf do
:dmsf_workflows => [:log]},
:read => true
permission :folder_manipulation,
{:dmsf => [:new, :create, :delete, :edit, :save, :edit_root, :save_root, :lock, :unlock, :notify_activate, :notify_deactivate, :delete_entries, :restore]}
{:dmsf => [:new, :create, :delete, :edit, :save, :edit_root, :save_root, :lock, :unlock, :notify_activate, :notify_deactivate, :restore]}
permission :file_manipulation,
{:dmsf_files => [:create_revision, :lock, :unlock, :delete_revision, :notify_activate, :notify_deactivate, :restore],
:dmsf_upload => [:upload_files, :upload_file, :commit_files],
:dmsf_links => [:new, :create, :destroy, :restore]
}
permission :file_delete, { :dmsf => [:trash], :dmsf_files => [:delete]}
permission :file_delete,
{ :dmsf => [:trash, :delete_entries],
:dmsf_files => [:delete]}
permission :force_file_unlock, {}
permission :file_approval,
{:dmsf_workflows => [:action, :new_action, :autocomplete_for_user, :start, :assign, :assignment]}