2015-10-21 17:13:07 +08:00
|
|
|
#coding=utf-8
|
|
|
|
#
|
|
|
|
#
|
|
|
|
require_relative 'helper'
|
|
|
|
module Trustie
|
|
|
|
module Gitlab
|
|
|
|
module ManageUser
|
|
|
|
include Helper
|
|
|
|
|
|
|
|
def self.included(base)
|
|
|
|
base.class_eval {
|
2015-11-01 22:25:42 +08:00
|
|
|
#before_create :add_gitlab_user
|
|
|
|
#before_destroy :delete_gitlab_user
|
2015-10-21 17:13:07 +08:00
|
|
|
before_save :change_gitlab_user
|
|
|
|
}
|
|
|
|
end
|
|
|
|
|
|
|
|
def add_gitlab_user
|
|
|
|
add_user(self)
|
|
|
|
end
|
|
|
|
|
|
|
|
def delete_gitlab_user
|
|
|
|
del_user(self)
|
|
|
|
end
|
|
|
|
|
|
|
|
def change_gitlab_user
|
|
|
|
change_password(self.gid, self.hashed_password, self.salt)
|
|
|
|
end
|
|
|
|
|
|
|
|
def g
|
|
|
|
@g ||= ::Gitlab.client
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|