Available projects for 'link to' operation #488

This commit is contained in:
Karel Picman 2015-12-08 15:00:03 +01:00
parent f360e1dbfa
commit a4a0a8e598

View File

@ -216,9 +216,9 @@ class DmsfFile < ActiveRecord::Base
def self.allowed_target_projects_on_copy
projects = []
if User.current.admin?
projects = Project.visible.all
projects = Project.visible.has_module('dmsf').all
elsif User.current.logged?
User.current.memberships.each {|m| projects << m.project if m.roles.detect {|r| r.allowed_to?(:file_manipulation)}}
User.current.memberships.each {|m| projects << m.project if m.roles.detect {|r| r.allowed_to?(:file_manipulation)} && m.project.module_enabled?('dmsf')}
end
projects
end