Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
gitlab-foss
提交
2f9d50b7
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,发现更多精彩内容 >>
提交
2f9d50b7
编写于
3月 24, 2017
作者:
G
George Andrinopoulos
提交者:
Rémy Coutable
3月 24, 2017
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Resolve "Gitlab administrator cannot create projects in every group"
上级
c0ce9d01
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
45 addition
and
2 deletion
+45
-2
app/helpers/namespaces_helper.rb
app/helpers/namespaces_helper.rb
+7
-1
app/views/projects/new.html.haml
app/views/projects/new.html.haml
+1
-1
changelogs/unreleased/27910-admin-can-create-project-in-all-groups.yml
...released/27910-admin-can-create-project-in-all-groups.yml
+4
-0
spec/helpers/namespaces_helper_spec.rb
spec/helpers/namespaces_helper_spec.rb
+33
-0
未找到文件。
app/helpers/namespaces_helper.rb
浏览文件 @
2f9d50b7
...
@@ -6,7 +6,13 @@ module NamespacesHelper
...
@@ -6,7 +6,13 @@ module NamespacesHelper
def
namespaces_options
(
selected
=
:current_user
,
display_path:
false
,
extra_group:
nil
)
def
namespaces_options
(
selected
=
:current_user
,
display_path:
false
,
extra_group:
nil
)
groups
=
current_user
.
owned_groups
+
current_user
.
masters_groups
groups
=
current_user
.
owned_groups
+
current_user
.
masters_groups
groups
<<
extra_group
if
extra_group
&&
!
Group
.
exists?
(
name:
extra_group
.
name
)
unless
extra_group
.
nil?
||
extra_group
.
is_a?
(
Group
)
extra_group
=
Group
.
find
(
extra_group
)
if
Namespace
.
find
(
extra_group
).
kind
==
'group'
end
if
extra_group
&&
extra_group
.
is_a?
(
Group
)
&&
(
!
Group
.
exists?
(
name:
extra_group
.
name
)
||
Ability
.
allowed?
(
current_user
,
:read_group
,
extra_group
))
groups
|=
[
extra_group
]
end
users
=
[
current_user
.
namespace
]
users
=
[
current_user
.
namespace
]
...
...
app/views/projects/new.html.haml
浏览文件 @
2f9d50b7
...
@@ -23,7 +23,7 @@
...
@@ -23,7 +23,7 @@
-
if
current_user
.
can_select_namespace?
-
if
current_user
.
can_select_namespace?
.input-group-addon
.input-group-addon
=
root_url
=
root_url
=
f
.
select
:namespace_id
,
namespaces_options
(
namespace_id_from
(
params
)
||
:current_user
,
display_path:
true
),
{},
{
class:
'select2 js-select-namespace'
,
tabindex:
1
}
=
f
.
select
:namespace_id
,
namespaces_options
(
namespace_id_from
(
params
)
||
:current_user
,
display_path:
true
,
extra_group:
namespace_id_from
(
params
)),
{},
{
class:
'select2 js-select-namespace'
,
tabindex:
1
}
-
else
-
else
.input-group-addon.static-namespace
.input-group-addon.static-namespace
...
...
changelogs/unreleased/27910-admin-can-create-project-in-all-groups.yml
0 → 100644
浏览文件 @
2f9d50b7
---
title
:
Allow admin to view all namespaces
merge_request
:
author
:
George Andrinopoulos
spec/helpers/namespaces_helper_spec.rb
0 → 100644
浏览文件 @
2f9d50b7
require
'spec_helper'
describe
NamespacesHelper
,
type: :helper
do
let!
(
:admin
)
{
create
(
:admin
)
}
let!
(
:admin_group
)
{
create
(
:group
,
:private
)
}
let!
(
:user
)
{
create
(
:user
)
}
let!
(
:user_group
)
{
create
(
:group
,
:private
)
}
before
do
admin_group
.
add_owner
(
admin
)
user_group
.
add_owner
(
user
)
end
describe
'#namespaces_options'
do
it
'returns groups without being a member for admin'
do
allow
(
helper
).
to
receive
(
:current_user
).
and_return
(
admin
)
options
=
helper
.
namespaces_options
(
user_group
.
id
,
display_path:
true
,
extra_group:
user_group
.
id
)
expect
(
options
).
to
include
(
admin_group
.
name
)
expect
(
options
).
to
include
(
user_group
.
name
)
end
it
'returns only allowed namespaces for user'
do
allow
(
helper
).
to
receive
(
:current_user
).
and_return
(
user
)
options
=
helper
.
namespaces_options
expect
(
options
).
not_to
include
(
admin_group
.
name
)
expect
(
options
).
to
include
(
user_group
.
name
)
end
end
end
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录