版本局角色同步

This commit is contained in:
huang 2016-02-23 09:12:50 +08:00
parent 20b2430da9
commit e62386ad65
2 changed files with 29 additions and 3 deletions

View File

@ -3,6 +3,15 @@
module Trustie
module Gitlab
module Helper
GUEST = 10
REPORTER = 20
DEVELOPER = 30
MASTER = 40
OWNER = 50
# 项目公开和私有
PUBLIC = 20
PRIVATE = 0
def change_password(uid, en_pwd, salt)
return unless uid
options = {:encrypted_password=>en_pwd, :password_salt=>salt}
@ -44,6 +53,21 @@ module Trustie
self.g.delete_user(user.gid)
end
def get_gitlab_role m
case m.roles.first.position
when 1,2
GUEST
when 5
REPORTER
when 4
DEVELOPER
when 3
MASTER
else
GUEST
end
end
end
end
end

View File

@ -61,7 +61,7 @@ module Trustie
unless gid
gid = sync_user(m.user).id
end
self.g.add_team_member(gproject.id, gid, UserLevel::DEVELOPER)
self.g.add_team_member(gproject.id, gid, get_gitlab_role(m))
rescue => e
puts e
end
@ -111,7 +111,7 @@ module Trustie
unless gid
gid = sync_user(m.user).id
end
self.g.add_team_member(gproject.id, gid, UserLevel::DEVELOPER)
self.g.add_team_member(gproject.id, gid, get_gitlab_role(m))
rescue => e
puts e
end
@ -125,7 +125,7 @@ module Trustie
unless gid
gid = sync_user(m.user).id
end
self.g.add_team_member(project.gpid, gid, UserLevel::DEVELOPER)
self.g.add_team_member(project.gpid, gid, get_gitlab_role(m))
rescue => e
puts e
end
@ -134,6 +134,8 @@ module Trustie
def remove_project
end
end
end