处理gitlab多个用户重复的问题
This commit is contained in:
parent
c0f1e355ec
commit
0baf7c521f
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue