Merge branch 'develop' into szzh
This commit is contained in:
commit
e4daad95b7
|
@ -607,6 +607,13 @@ class ProjectsController < ApplicationController
|
|||
@project.organization_id = params[:organization_id]
|
||||
params[:project][:is_public] ? @project.is_public = 1 : @project.is_public = 0
|
||||
params[:project][:hidden_repo] ? @project.hidden_repo = 1 : @project.hidden_repo = 0
|
||||
# 更新公开私有时同步gitlab公开私有
|
||||
unless @project.gpid.nil?
|
||||
g = Gitlab.client
|
||||
gproject = g.project(@project.gpid)
|
||||
params[:project][:is_public] ? g.edit_project(gproject.id, 20) : g.edit_project(gproject.id, 0)
|
||||
end
|
||||
# end
|
||||
if validate_parent_id && @project.save
|
||||
@project.set_allowed_parent!(params[:project]['parent_id']) if params[:project].has_key?('parent_id')
|
||||
if params[:project][:is_public] == '0'
|
||||
|
|
|
@ -72,6 +72,23 @@ class Gitlab::Client
|
|||
post(url, :body => {:name => name}.merge(options))
|
||||
end
|
||||
|
||||
# Updates a project team member to a specified access level.
|
||||
# id (required) - The ID of a project
|
||||
# name (optional) - project name
|
||||
# path (optional) - repository name for project
|
||||
# description (optional) - short project description
|
||||
# default_branch (optional)
|
||||
# issues_enabled (optional)
|
||||
# merge_requests_enabled (optional)
|
||||
# wiki_enabled (optional)
|
||||
# snippets_enabled (optional)
|
||||
# public (optional) - if true same as setting visibility_level = 20
|
||||
# visibility_level (optional)
|
||||
|
||||
def edit_project(id, visibility_level)
|
||||
put("/projects/#{id}", :body => {:visibility_level => visibility_level})
|
||||
end
|
||||
|
||||
# Deletes a project.
|
||||
#
|
||||
# @example
|
||||
|
|
|
@ -10,6 +10,9 @@ module Trustie
|
|||
DEVELOPER = 30
|
||||
MASTER = 40
|
||||
OWNER = 50
|
||||
# 项目公开和私有
|
||||
PUBLIC = 20
|
||||
PRIVATE = 0
|
||||
end
|
||||
|
||||
class Sync
|
||||
|
@ -45,7 +48,8 @@ module Trustie
|
|||
issues_enabled: false,
|
||||
snippets_enabled: false,
|
||||
public: false,
|
||||
user_id: gid
|
||||
user_id: gid,
|
||||
visibility_level: project.is_public? ? UserLevel::PUBLIC : UserLevel::PRIVATE
|
||||
)
|
||||
project.gpid = gproject.id
|
||||
project.save!
|
||||
|
@ -84,7 +88,8 @@ module Trustie
|
|||
merge_requests_enabled: true,
|
||||
public: false,
|
||||
user_id: gid,
|
||||
import_url: import_url
|
||||
import_url: import_url,
|
||||
visibility_level: project.is_public? ? UserLevel::PUBLIC : UserLevel::PRIVATE
|
||||
)
|
||||
puts "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"
|
||||
project.gpid = gproject.id
|
||||
|
|
Loading…
Reference in New Issue