Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
gitlab-foss
提交
d7e2ac72
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,发现更多精彩内容 >>
提交
d7e2ac72
编写于
4月 24, 2017
作者:
D
Douwe Maan
提交者:
Stan Hu
4月 24, 2017
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix OAuth, LDAP and SAML SSO when regular sign-ups are disabled
上级
080aac05
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
47 addition
and
5 deletion
+47
-5
app/services/users/build_service.rb
app/services/users/build_service.rb
+2
-2
app/services/users/create_service.rb
app/services/users/create_service.rb
+2
-2
changelogs/unreleased/dm-fix-oauth-user-creation.yml
changelogs/unreleased/dm-fix-oauth-user-creation.yml
+4
-0
lib/gitlab/o_auth/user.rb
lib/gitlab/o_auth/user.rb
+1
-1
spec/lib/gitlab/ldap/user_spec.rb
spec/lib/gitlab/ldap/user_spec.rb
+12
-0
spec/lib/gitlab/o_auth/user_spec.rb
spec/lib/gitlab/o_auth/user_spec.rb
+14
-0
spec/lib/gitlab/saml/user_spec.rb
spec/lib/gitlab/saml/user_spec.rb
+12
-0
未找到文件。
app/services/users/build_service.rb
浏览文件 @
d7e2ac72
...
...
@@ -6,8 +6,8 @@ module Users
@params
=
params
.
dup
end
def
execute
raise
Gitlab
::
Access
::
AccessDeniedError
unless
can_create_user?
def
execute
(
skip_authorization:
false
)
raise
Gitlab
::
Access
::
AccessDeniedError
unless
skip_authorization
||
can_create_user?
user
=
User
.
new
(
build_user_params
)
...
...
app/services/users/create_service.rb
浏览文件 @
d7e2ac72
...
...
@@ -6,8 +6,8 @@ module Users
@params
=
params
.
dup
end
def
execute
user
=
Users
::
BuildService
.
new
(
current_user
,
params
).
execute
def
execute
(
skip_authorization:
false
)
user
=
Users
::
BuildService
.
new
(
current_user
,
params
).
execute
(
skip_authorization:
skip_authorization
)
@reset_token
=
user
.
generate_reset_token
if
user
.
recently_sent_password_reset?
...
...
changelogs/unreleased/dm-fix-oauth-user-creation.yml
0 → 100644
浏览文件 @
d7e2ac72
---
title
:
Fix OAuth, LDAP and SAML SSO when regular sign-ups are disabled
merge_request
:
author
:
lib/gitlab/o_auth/user.rb
浏览文件 @
d7e2ac72
...
...
@@ -148,7 +148,7 @@ module Gitlab
def
build_new_user
user_params
=
user_attributes
.
merge
(
extern_uid:
auth_hash
.
uid
,
provider:
auth_hash
.
provider
,
skip_confirmation:
true
)
Users
::
BuildService
.
new
(
nil
,
user_params
).
execute
Users
::
BuildService
.
new
(
nil
,
user_params
).
execute
(
skip_authorization:
true
)
end
def
user_attributes
...
...
spec/lib/gitlab/ldap/user_spec.rb
浏览文件 @
d7e2ac72
...
...
@@ -108,6 +108,18 @@ describe Gitlab::LDAP::User, lib: true do
it
"creates a new user if not found"
do
expect
{
ldap_user
.
save
}.
to
change
{
User
.
count
}.
by
(
1
)
end
context
'when signup is disabled'
do
before
do
stub_application_setting
signup_enabled:
false
end
it
'creates the user'
do
ldap_user
.
save
expect
(
gl_user
).
to
be_persisted
end
end
end
describe
'updating email'
do
...
...
spec/lib/gitlab/o_auth/user_spec.rb
浏览文件 @
d7e2ac72
...
...
@@ -40,6 +40,20 @@ describe Gitlab::OAuth::User, lib: true do
let
(
:provider
)
{
'twitter'
}
describe
'signup'
do
context
'when signup is disabled'
do
before
do
stub_application_setting
signup_enabled:
false
end
it
'creates the user'
do
stub_omniauth_config
(
allow_single_sign_on:
[
'twitter'
])
oauth_user
.
save
expect
(
gl_user
).
to
be_persisted
end
end
it
'marks user as having password_automatically_set'
do
stub_omniauth_config
(
allow_single_sign_on:
[
'twitter'
],
external_providers:
[
'twitter'
])
...
...
spec/lib/gitlab/saml/user_spec.rb
浏览文件 @
d7e2ac72
...
...
@@ -211,6 +211,18 @@ describe Gitlab::Saml::User, lib: true do
end
end
end
context
'when signup is disabled'
do
before
do
stub_application_setting
signup_enabled:
false
end
it
'creates the user'
do
saml_user
.
save
expect
(
gl_user
).
to
be_persisted
end
end
end
describe
'blocking'
do
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录