diff --git a/app/controllers/ssos_controller.rb b/app/controllers/ssos_controller.rb index 9f05fc19b..9a5042c50 100644 --- a/app/controllers/ssos_controller.rb +++ b/app/controllers/ssos_controller.rb @@ -27,8 +27,10 @@ class SsosController < ApplicationController ## 加入组织 @organization = Organization.find(82) unless @organization.org_members.exists?(user_id: sso.user_id) - member = OrgMember.new(:user_id => sso.user_id) + member = OrgMember.create(:user_id => sso.user_id, :created_at => Time.now) + # member = OrgMember.new(:user_id => sso.user_id) @organization.org_members << member + OrgMemberRole.create(:org_member_id => member.id, :role_id => 12) end ## 选择性跳转 diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index babeb5f30..1d43ff69a 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -88,11 +88,13 @@ module ApplicationHelper # 获取组织成员中文名字 def get_org_member_role_name member - case member.roles[0].name - when 'orgManager' - '管理人员' - when 'orgMember' - '组织成员' + unless member.roles[0].nil? + case member.roles[0].name + when 'orgManager' + '管理人员' + when 'orgMember' + '组织成员' + end end end diff --git a/app/views/layouts/base_org2.html.erb b/app/views/layouts/base_org2.html.erb index dd85d2e4b..799aaa42b 100644 --- a/app/views/layouts/base_org2.html.erb +++ b/app/views/layouts/base_org2.html.erb @@ -62,7 +62,7 @@
添加成员
<%= form_tag url_for(:controller => 'org_member', :action => 'create', :org => @organization),:id=>'org_member_add_form',:remote=>true do |f|%> - <% if @organization.secdomain_name.nil? %> + <%# if @organization.secdomain_name.nil? %> <%= javascript_tag "observeSearchfield('not_org_member_search', null, '#{ escape_javascript host_with_protocol + "/org_member/org_member_autocomplete?" + {:org=> @organization.id}.to_query }')" %> - <% else %> - <%= javascript_tag "observeSearchfield('not_org_member_search', null, '#{ escape_javascript secdomain_with_protocol(@organization.secdomain_name) + "/org_member/org_member_autocomplete?" + {:org=> @organization.id}.to_query }')" %> - <% end %> + <%# else %> + <%#= javascript_tag "observeSearchfield('not_org_member_search', null, '#{ escape_javascript secdomain_with_protocol(@organization.secdomain_name) + "/org_member/org_member_autocomplete?" + {:org=> @organization.id}.to_query }')" %> + <%# end %>