Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
e58a5e24
Commit
e58a5e24
authored
Mar 14, 2019
by
James Lopez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactor URL display logic
parent
adbb8233
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
13 additions
and
8 deletions
+13
-8
ee/app/controllers/groups/saml_providers_controller.rb
ee/app/controllers/groups/saml_providers_controller.rb
+3
-2
ee/app/controllers/groups/scim_oauth_controller.rb
ee/app/controllers/groups/scim_oauth_controller.rb
+2
-2
ee/app/models/scim_oauth_access_token.rb
ee/app/models/scim_oauth_access_token.rb
+4
-0
ee/spec/controllers/groups/saml_providers_controller_spec.rb
ee/spec/controllers/groups/saml_providers_controller_spec.rb
+4
-4
No files found.
ee/app/controllers/groups/saml_providers_controller.rb
View file @
e58a5e24
...
...
@@ -12,8 +12,9 @@ class Groups::SamlProvidersController < Groups::ApplicationController
def
show
@saml_provider
=
@group
.
saml_provider
||
@group
.
build_saml_provider
@scim_token_exists
=
ScimOauthAccessToken
.
exists?
(
group:
@group
)
@scim_token_url
=
group_scim_oauth_url
(
@group
)
scim_token
=
ScimOauthAccessToken
.
find_by_group_id
(
@group
.
id
)
@scim_token_url
=
scim_token
.
as_entity_json
[
:scim_api_url
]
if
scim_token
end
# rubocop: enable CodeReuse/ActiveRecord
...
...
ee/app/controllers/groups/scim_oauth_controller.rb
View file @
e58a5e24
...
...
@@ -15,7 +15,7 @@ class Groups::ScimOauthController < Groups::ApplicationController
respond_to
do
|
format
|
format
.
json
do
if
scim_token
render
json:
ScimOauthAccessTokenEntity
.
new
(
scim_token
).
as
_json
render
json:
scim_token
.
as_entity
_json
else
render
json:
{}
end
...
...
@@ -36,7 +36,7 @@ class Groups::ScimOauthController < Groups::ApplicationController
respond_to
do
|
format
|
format
.
json
do
if
scim_token
.
valid?
render
json:
ScimOauthAccessTokenEntity
.
new
(
scim_token
).
as
_json
render
json:
scim_token
.
as_entity
_json
else
render
json:
{
errors:
scim_token
.
errors
.
full_messages
},
status: :unprocessable_entity
end
...
...
ee/app/models/scim_oauth_access_token.rb
View file @
e58a5e24
...
...
@@ -9,4 +9,8 @@ class ScimOauthAccessToken < ApplicationRecord
validates
:group
,
presence:
true
before_save
:ensure_token
def
as_entity_json
ScimOauthAccessTokenEntity
.
new
(
self
).
as_json
end
end
ee/spec/controllers/groups/saml_providers_controller_spec.rb
View file @
e58a5e24
...
...
@@ -79,21 +79,21 @@ describe Groups::SamlProvidersController do
expect
(
response
).
to
render_template
'groups/saml_providers/show'
end
it
'has
the
SCIM token URL'
do
it
'has
no
SCIM token URL'
do
group
.
add_owner
(
user
)
subject
expect
(
assigns
(
:scim_token_url
)).
to
eq
(
'http://test.host/groups/group1/-/scim_oauth'
)
expect
(
assigns
(
:scim_token_url
)).
to
be_nil
end
it
'
sets scim_token_exists if SCIM token is found
'
do
it
'
has the SCIM token URL when it exists
'
do
create
(
:scim_oauth_access_token
,
group:
group
)
group
.
add_owner
(
user
)
subject
expect
(
assigns
(
:scim_token_
exists
)).
to
be
true
expect
(
assigns
(
:scim_token_
url
)).
to
eq
(
"http://localhost/api/scim/v2/groups/
#{
group
.
full_path
}
"
)
end
context
'not on a top level group'
,
:nested_groups
do
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment