|
|
|
@ -4,7 +4,9 @@ namespace :gitlab do
|
|
|
|
|
module Helper
|
|
|
|
|
def self.change_password(uid, en_pwd, salt)
|
|
|
|
|
g = Gitlab.client
|
|
|
|
|
g.edit_user(uid, :encrypted_password=>en_pwd, :password_salt=>salt)
|
|
|
|
|
options = {:encrypted_password=>en_pwd, :password_salt=>salt}
|
|
|
|
|
g.put("/users/ext/#{uid}", :body => options)
|
|
|
|
|
# g.edit_user(uid, :encrypted_password=>en_pwd, :password_salt=>salt)
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
@ -17,7 +19,7 @@ namespace :gitlab do
|
|
|
|
|
g = Gitlab.client
|
|
|
|
|
u = g.get("/users?search=#{user.mail}").first
|
|
|
|
|
unless u
|
|
|
|
|
u = g.create_user(user.mail, user.hashed_password, name: user.show_name, username: user.login)
|
|
|
|
|
u = g.create_user(user.mail, user.hashed_password, name: user.show_name, username: user.login, confirm: "true")
|
|
|
|
|
user.gid = u.id
|
|
|
|
|
user.save!
|
|
|
|
|
puts "create user #{user.login}"
|
|
|
|
@ -44,6 +46,9 @@ namespace :gitlab do
|
|
|
|
|
path = project.repositories.where(:is_default => true).first.root_url.split('/').last
|
|
|
|
|
path = path.split('.').first
|
|
|
|
|
raise "unknow path" unless path
|
|
|
|
|
|
|
|
|
|
# import url http://xianbo_trustie2:1234@repository.trustie.net/xianbo/trustie2.git
|
|
|
|
|
# can use password
|
|
|
|
|
gproject = g.create_project(project.identifier,
|
|
|
|
|
path: path,
|
|
|
|
|
description: project.description,
|
|
|
|
|