0
我看到插件附件有问题,它显示我的消息:您无权访问此页面。我使用附件助手在我的插件中上传东西。下面是代码: Init.rb(给予许可)我不能看到我的附件从redmine插件
project_module:PLUGIN_NAME做
permission :view_attachments, :attachments => [:show, :download, :thumbnail, :upload]
模型类,在我的情况Unit.rb
class Unit < ActiveRecord::Base
belongs_to :project
acts_as_attachable :view_permission => :view_attachments
units_controller.rb
class UnitsController < ApplicationController
helper :attachments
include AttachmentsHelper
menu_item :overviews, :only => [:index, :show, :edit, :new, :update, :create]
before_filter(:find_project, :authorize, :only => [:index, :show, :edit, :new, :update, :create])
...
def create
@unit = Unit.new(unit_params)
if(@unit.save)
attachments = Attachment.attach_files(@unit, params[:attachments])
redirect_to(:action => "index")
flash[:notice] = l(:createMessage)
else
render("new")
end
end
units show.html.erb
<%= link_to_attachments @unit %>
PS-当我删除的attachments_controller这部分代码的话,我可以看到我的附件,见下图:
before_filter :file_readable, :read_authorize, :only => [:show, :download, :thumbnail]
read_authorize行动:
def read_authorize
@attachment.visible? ? true : deny_access
end
我试过,但它不工作,我让他们都:公共=>真实的,但还是犯规给我的权限附件 – ILLYRIUM