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 @@