处理gitlab多个用户重复的问题

This commit is contained in:
huang 2018-06-12 17:06:15 +08:00
parent c0f1e355ec
commit 0baf7c521f
2 changed files with 13 additions and 13 deletions

View File

@ -62,18 +62,18 @@ module Gitlab
# Checks the response code for common errors.
# Returns parsed response for successful requests.
def validate(response)
case response.code
when 400; raise Error::BadRequest.new error_message(response)
when 401; raise Error::Unauthorized.new error_message(response)
when 403; raise Error::Forbidden.new error_message(response)
when 404; raise Error::NotFound.new error_message(response)
when 405; raise Error::MethodNotAllowed.new error_message(response)
when 406; raise Error::DataNotAccepted.new error_message(response)
when 409; raise Error::Conflict.new error_message(response)
when 500; raise Error::InternalServerError.new error_message(response)
when 502; raise Error::BadGateway.new error_message(response)
when 503; raise Error::ServiceUnavailable.new error_message(response)
end
# case response.code
# when 400; raise Error::BadRequest.new error_message(response)
# when 401; raise Error::Unauthorized.new error_message(response)
# when 403; raise Error::Forbidden.new error_message(response)
# when 404; raise Error::NotFound.new error_message(response)
# when 405; raise Error::MethodNotAllowed.new error_message(response)
# when 406; raise Error::DataNotAccepted.new error_message(response)
# when 409; raise Error::Conflict.new error_message(response)
# when 500; raise Error::InternalServerError.new error_message(response)
# when 502; raise Error::BadGateway.new error_message(response)
# when 503; raise Error::ServiceUnavailable.new error_message(response)
# end
response.parsed_response
end

View File

@ -34,7 +34,7 @@ namespace :gitlab do
# users = User.where(:gid => 8823)
users.each do |user|
puts "start"+ "#{user.id}"
if Member.where("project_id >0 and user_id =?", user.id).blank?
if Member.where("project_id >0 and user_id =?", user.id).blank? || g.user(user.gid).try(:username) != user.login
puts user.id
user.update_column(:gid, nil)
end