21 lines
676 B
Ruby
21 lines
676 B
Ruby
module SharesHelper
|
|
def options_from_select_project(user)
|
|
@membership = user.memberships.all(:conditions => Project.visible_condition(User.current))
|
|
@option = []
|
|
@membership.each do |membership|
|
|
unless(membership.project.project_type==1)
|
|
#membership.member_roles.each{|role|
|
|
# if(role.role_id == 3)
|
|
# @option << membership.project
|
|
# end
|
|
#}
|
|
#拥有编辑项目权限的可操作该项目
|
|
if user.allowed_to?({:controller => "projects", :action => "edit"}, membership.project, :global => false)
|
|
@option << membership.project
|
|
end
|
|
end
|
|
end
|
|
options_for_select(@option)
|
|
end
|
|
end
|