From 7cc12f034dacec4ac95d40e45f4bdbb5e3447bad Mon Sep 17 00:00:00 2001 From: huang Date: Fri, 22 Sep 2017 20:04:32 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B7=B2=E5=8F=91=E5=B8=83=E5=AE=9E=E8=AE=AD?= =?UTF-8?q?=E7=89=88=E6=9C=AC=E5=BA=93=E6=8E=A7=E5=88=B6=E6=9D=83=E9=99=90?= =?UTF-8?q?=E8=BF=81=E7=A7=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...0922112450_sync_publish_game_for_gitlab.rb | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 db/migrate/20170922112450_sync_publish_game_for_gitlab.rb diff --git a/db/migrate/20170922112450_sync_publish_game_for_gitlab.rb b/db/migrate/20170922112450_sync_publish_game_for_gitlab.rb new file mode 100644 index 000000000..e91a6cd12 --- /dev/null +++ b/db/migrate/20170922112450_sync_publish_game_for_gitlab.rb @@ -0,0 +1,22 @@ +class SyncPublishGameForGitlab < ActiveRecord::Migration + def up + begin + g = Gitlab.client + shixuns = Shixun.where(:status => 2) + shixuns.each do |shixun| + shixun.shixun_members.each do |member| + gid = User.find(member.user_id).try(:gid) + g.edit_team_member(shixun.gpid, gid, 10) # 3代表角色master + end + # 加入超级管理员 + admin_gid = User.where(:admin => 1).first.try(:gid) + g.add_team_member(shixun.gpid, admin_gid, 40) # 30代表角色master + end + rescue Exception => e + puts e.message + end + end + + def down + end +end