2013-08-01 20:26:19 +08:00
|
|
|
module SharesHelper
|
2013-10-21 08:57:55 +08:00
|
|
|
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)
|
2014-06-09 13:47:39 +08:00
|
|
|
#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)
|
2013-10-21 08:57:55 +08:00
|
|
|
@option << membership.project
|
2014-06-09 13:47:39 +08:00
|
|
|
end
|
2013-10-21 08:57:55 +08:00
|
|
|
end
|
|
|
|
end
|
|
|
|
options_for_select(@option)
|
|
|
|
end
|
2013-08-01 20:26:19 +08:00
|
|
|
end
|