Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
gitlab-foss
提交
c9370b75
G
gitlab-foss
项目概览
李少辉-开发者
/
gitlab-foss
通知
15
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
G
gitlab-foss
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
c9370b75
编写于
6月 19, 2013
作者:
D
Dmitriy Zaporozhets
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'remove/root_namespace' of /home/git/repositories/gitlab/gitlabhq into 6-0-dev
上级
d274ca38
b3ef63a0
变更
16
隐藏空白更改
内联
并排
Showing
16 changed file
with
21 addition
and
111 deletion
+21
-111
app/contexts/projects/create_context.rb
app/contexts/projects/create_context.rb
+3
-7
app/contexts/projects/transfer_context.rb
app/contexts/projects/transfer_context.rb
+1
-6
app/controllers/admin/projects_controller.rb
app/controllers/admin/projects_controller.rb
+0
-1
app/controllers/application_controller.rb
app/controllers/application_controller.rb
+0
-8
app/helpers/admin/teams/members_helper.rb
app/helpers/admin/teams/members_helper.rb
+0
-5
app/helpers/admin/teams/projects_helper.rb
app/helpers/admin/teams/projects_helper.rb
+0
-5
app/helpers/namespaces_helper.rb
app/helpers/namespaces_helper.rb
+0
-2
app/models/concerns/issuable.rb
app/models/concerns/issuable.rb
+0
-1
app/models/project.rb
app/models/project.rb
+0
-6
app/views/dashboard/_teams.html.haml
app/views/dashboard/_teams.html.haml
+0
-23
app/views/layouts/nav/_team.html.haml
app/views/layouts/nav/_team.html.haml
+0
-25
app/views/projects/edit.html.haml
app/views/projects/edit.html.haml
+1
-1
app/views/team_members/_assigned_team.html.haml
app/views/team_members/_assigned_team.html.haml
+0
-10
app/views/team_members/_assigned_teams.html.haml
app/views/team_members/_assigned_teams.html.haml
+0
-4
app/views/team_members/index.html.haml
app/views/team_members/index.html.haml
+0
-7
lib/tasks/migrate/migrate_global_projects.rake
lib/tasks/migrate/migrate_global_projects.rake
+16
-0
未找到文件。
app/contexts/projects/create_context.rb
浏览文件 @
c9370b75
...
...
@@ -33,7 +33,7 @@ module Projects
# Find matching namespace and check if it allowed
# for current user if namespace_id passed.
if
allowed_namespace?
(
current_user
,
namespace_id
)
@project
.
namespace_id
=
namespace_id
unless
namespace_id
==
Namespace
.
global_id
@project
.
namespace_id
=
namespace_id
else
deny_namespace
return
@project
...
...
@@ -75,12 +75,8 @@ module Projects
end
def
allowed_namespace?
(
user
,
namespace_id
)
if
namespace_id
==
Namespace
.
global_id
return
user
.
admin
else
namespace
=
Namespace
.
find_by_id
(
namespace_id
)
current_user
.
can?
(
:manage_namespace
,
namespace
)
end
namespace
=
Namespace
.
find_by_id
(
namespace_id
)
current_user
.
can?
(
:manage_namespace
,
namespace
)
end
end
end
app/contexts/projects/transfer_context.rb
浏览文件 @
c9370b75
...
...
@@ -5,12 +5,7 @@ module Projects
allowed_transfer
=
can?
(
current_user
,
:change_namespace
,
project
)
||
role
==
:admin
if
allowed_transfer
&&
namespace_id
.
present?
if
namespace_id
==
Namespace
.
global_id
if
project
.
namespace
.
present?
# Transfer to global namespace from anyone
project
.
transfer
(
nil
)
end
elsif
namespace_id
.
to_i
!=
project
.
namespace_id
if
namespace_id
.
to_i
!=
project
.
namespace_id
# Transfer to someone namespace
namespace
=
Namespace
.
find
(
namespace_id
)
project
.
transfer
(
namespace
)
...
...
app/controllers/admin/projects_controller.rb
浏览文件 @
c9370b75
...
...
@@ -9,7 +9,6 @@ class Admin::ProjectsController < Admin::ApplicationController
@projects
=
@projects
.
where
(
public:
true
)
if
params
[
:public_only
].
present?
@projects
=
@projects
.
with_push
if
params
[
:with_push
].
present?
@projects
=
@projects
.
abandoned
if
params
[
:abandoned
].
present?
@projects
=
@projects
.
where
(
namespace_id:
nil
)
if
params
[
:namespace_id
]
==
Namespace
.
global_id
@projects
=
@projects
.
search
(
params
[
:name
])
if
params
[
:name
].
present?
@projects
=
@projects
.
includes
(
:namespace
).
order
(
"namespaces.path, projects.name ASC"
).
page
(
params
[
:page
]).
per
(
20
)
end
...
...
app/controllers/application_controller.rb
浏览文件 @
c9370b75
...
...
@@ -95,14 +95,6 @@ class ApplicationController < ActionController::Base
return
access_denied!
unless
can?
(
current_user
,
:create_team
,
nil
)
end
def
authorize_manage_user_team!
return
access_denied!
unless
user_team
.
present?
&&
can?
(
current_user
,
:manage_user_team
,
user_team
)
end
def
authorize_admin_user_team!
return
access_denied!
unless
user_team
.
present?
&&
can?
(
current_user
,
:admin_user_team
,
user_team
)
end
def
access_denied!
render
"errors/access_denied"
,
layout:
"errors"
,
status:
404
end
...
...
app/helpers/admin/teams/members_helper.rb
已删除
100644 → 0
浏览文件 @
d274ca38
module
Admin::Teams::MembersHelper
def
member_since
(
team
,
member
)
team
.
user_team_user_relationships
.
find_by_user_id
(
member
).
created_at
end
end
app/helpers/admin/teams/projects_helper.rb
已删除
100644 → 0
浏览文件 @
d274ca38
module
Admin::Teams::ProjectsHelper
def
assigned_since
(
team
,
project
)
team
.
user_team_project_relationships
.
find_by_project_id
(
project
).
created_at
end
end
app/helpers/namespaces_helper.rb
浏览文件 @
c9370b75
...
...
@@ -3,12 +3,10 @@ module NamespacesHelper
groups
=
current_user
.
owned_groups
.
select
{
|
n
|
n
.
type
==
'Group'
}
users
=
current_user
.
namespaces
.
reject
{
|
n
|
n
.
type
==
'Group'
}
global_opts
=
[
"Global"
,
[[
'/'
,
Namespace
.
global_id
]]
]
group_opts
=
[
"Groups"
,
groups
.
sort_by
(
&
:human_name
).
map
{
|
g
|
[
g
.
human_name
,
g
.
id
]}
]
users_opts
=
[
"Users"
,
users
.
sort_by
(
&
:human_name
).
map
{
|
u
|
[
u
.
human_name
,
u
.
id
]}
]
options
=
[]
options
<<
global_opts
if
current_user
.
admin
options
<<
group_opts
options
<<
users_opts
...
...
app/models/concerns/issuable.rb
浏览文件 @
c9370b75
...
...
@@ -21,7 +21,6 @@ module Issuable
scope
:opened
,
->
{
with_state
(
:opened
)
}
scope
:closed
,
->
{
with_state
(
:closed
)
}
scope
:of_group
,
->
(
group
)
{
where
(
project_id:
group
.
project_ids
)
}
scope
:of_user_team
,
->
(
team
)
{
where
(
project_id:
team
.
project_ids
,
assignee_id:
team
.
member_ids
)
}
scope
:assigned_to
,
->
(
u
)
{
where
(
assignee_id:
u
.
id
)}
scope
:recent
,
->
{
order
(
"created_at DESC"
)
}
scope
:assigned
,
->
{
where
(
"assignee_id IS NOT NULL"
)
}
...
...
app/models/project.rb
浏览文件 @
c9370b75
...
...
@@ -61,12 +61,6 @@ class Project < ActiveRecord::Base
has_many
:snippets
,
dependent: :destroy
,
class_name:
"ProjectSnippet"
has_many
:hooks
,
dependent: :destroy
,
class_name:
"ProjectHook"
has_many
:protected_branches
,
dependent: :destroy
has_many
:user_team_project_relationships
,
dependent: :destroy
has_many
:users
,
through: :users_projects
has_many
:user_teams
,
through: :user_team_project_relationships
has_many
:user_team_user_relationships
,
through: :user_teams
has_many
:user_teams_members
,
through: :user_team_user_relationships
has_many
:deploy_keys_projects
,
dependent: :destroy
has_many
:deploy_keys
,
through: :deploy_keys_projects
...
...
app/views/dashboard/_teams.html.haml
已删除
100644 → 0
浏览文件 @
d274ca38
.ui-box.teams-box
%h5
.title
Teams
%span
.light
(
#{
teams
.
count
}
)
%span
.pull-right
=
link_to
new_team_path
,
class:
"btn btn-small"
do
%i
.icon-plus
New Team
%ul
.well-list
-
teams
.
each
do
|
team
|
%li
=
link_to
team_path
(
id:
team
.
path
),
class:
dom_class
(
team
)
do
%strong
.well-title
=
truncate
(
team
.
name
,
length:
35
)
%span
.pull-right.light
-
if
team
.
owner
==
current_user
%i
.icon-wrench
-
tm
=
current_user
.
user_team_user_relationships
.
find_by_user_team_id
(
team
.
id
)
-
if
tm
=
tm
.
access_human
-
if
teams
.
blank?
%li
%h3
.nothing_here_message
You have no teams yet.
app/views/layouts/nav/_team.html.haml
已删除
100644 → 0
浏览文件 @
d274ca38
%ul
=
nav_link
(
path:
'teams#show'
,
html_options:
{
class:
'home'
})
do
=
link_to
team_path
(
@team
),
title:
"Home"
do
%i
.icon-home
=
nav_link
(
path:
'teams#issues'
)
do
=
link_to
issues_team_path
(
@team
)
do
Issues
%span
.count
=
Issue
.
opened
.
of_user_team
(
@team
).
count
=
nav_link
(
path:
'teams#merge_requests'
)
do
=
link_to
merge_requests_team_path
(
@team
)
do
Merge Requests
%span
.count
=
MergeRequest
.
opened
.
of_user_team
(
@team
).
count
=
nav_link
(
controller:
[
:members
])
do
=
link_to
team_members_path
(
@team
),
class:
"team-tab tab"
do
Members
%span
.count
=
@team
.
members
.
count
-
if
can?
current_user
,
:manage_user_team
,
@team
=
nav_link
(
path:
'teams#edit'
)
do
=
link_to
edit_team_path
(
@team
),
class:
"stat-tab tab "
do
Settings
app/views/projects/edit.html.haml
浏览文件 @
c9370b75
...
...
@@ -129,7 +129,7 @@
%span
Namespace
.controls
.clearfix
=
f
.
select
:namespace_id
,
namespaces_options
(
@project
.
namespace_id
||
Namespace
::
global_id
),
{
prompt:
'Choose a project namespace'
},
{
class:
'chosen'
}
=
f
.
select
:namespace_id
,
namespaces_options
(
@project
.
namespace_id
),
{
prompt:
'Choose a project namespace'
},
{
class:
'chosen'
}
%ul
%li
Be careful. Changing project namespace can have unintended side effects
%li
You can transfer project only to namespaces you can manage
...
...
app/views/team_members/_assigned_team.html.haml
已删除
100644 → 0
浏览文件 @
d274ca38
%li
{
id:
dom_id
(
team
),
class:
"user_team_row team_#{team.id}"
}
.pull-right
-
if
can?
(
current_user
,
:admin_team_member
,
@project
)
=
link_to
resign_project_team_path
(
@project
,
team
),
method: :delete
,
confirm:
"Are you sure?"
,
class:
"btn btn-remove btn-tiny"
do
%i
.icon-minus.icon-white
%strong
=
link_to
team
.
name
,
team_path
(
team
),
title:
team
.
name
,
class:
"dark"
%br
%small
.cgray
Members:
#{
team
.
members
.
count
}
%small
.cgray
Max access:
#{
team_relation
.
human_max_access
}
app/views/team_members/_assigned_teams.html.haml
已删除
100644 → 0
浏览文件 @
d274ca38
.ui-box
%ul
.well-list
-
assigned_teams
.
sort_by
(
&
:team_name
).
each
do
|
team_relation
|
=
render
"team_members/assigned_team"
,
team_relation:
team_relation
,
team:
team_relation
.
user_team
app/views/team_members/index.html.haml
浏览文件 @
c9370b75
...
...
@@ -24,10 +24,3 @@
-
else
=
render
"team_members/team"
,
members:
@users_projects
-
if
@assigned_teams
.
present?
%h5
Assigned teams
(
#{
@project
.
user_teams
.
count
}
)
%div
=
render
"team_members/assigned_teams"
,
assigned_teams:
@assigned_teams
lib/tasks/migrate/migrate_global_projects.rake
0 → 100644
浏览文件 @
c9370b75
desc
"GITLAB | Migrate Global Projects to Namespaces"
task
migrate_global_projects: :environment
do
puts
"This will move all projects without namespace to owner namespace"
ask_to_continue
Project
.
where
(
namespace_id:
nil
).
find_each
(
batch_size:
20
)
do
|
project
|
begin
project
.
transfer
(
project
.
owner
.
namespace
)
print
'.'
rescue
=>
ex
puts
ex
.
message
print
'F'
end
end
end
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录