gitlab版本库成员同步任务

This commit is contained in:
huang 2016-04-21 16:04:00 +08:00
parent 42076a137d
commit 81f8559c48
2 changed files with 17 additions and 1 deletions

View File

@ -11,6 +11,22 @@ namespace :gitlab do
end
end
task :members => :environment do
projects = Project.where("gpid is not null")
s = Trustie::Gitlab::Sync.new
g = Gitlab.client
projects.each do |project|
begin
if project.members.count != g.team_members(project.gpid).count
puts project.id
s.only_members(project)
end
rescue => e
puts e
end
end
end
desc "update user password"
task :password => :environment do
s = Trustie::Gitlab::Sync.new

View File

@ -122,7 +122,7 @@ module Trustie
project.members.each do |m|
begin
gid = m.user.gid
unless gid
if gid.nil?
gid = sync_user(m.user).id
end
self.g.add_team_member(project.gpid, gid, get_gitlab_role(m))