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
92dc05c4
Commit
92dc05c4
authored
Feb 25, 2019
by
James Lopez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add users entity
parent
1cec65d0
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
83 additions
and
0 deletions
+83
-0
ee/lib/ee/gitlab/scim/users.rb
ee/lib/ee/gitlab/scim/users.rb
+45
-0
ee/spec/lib/gitlab/scim/users_spec.rb
ee/spec/lib/gitlab/scim/users_spec.rb
+38
-0
No files found.
ee/lib/ee/gitlab/scim/users.rb
0 → 100644
View file @
92dc05c4
# frozen_string_literal: true
module
EE
module
Gitlab
module
Scim
class
Users
<
Grape
::
Entity
expose
:schemas
expose
:total_results
,
as: :totalResults
expose
:items_per_page
,
as: :itemsPerPage
expose
:start_index
,
as: :startIndex
present_collection
true
,
:Resources
expose
:resources
,
as: :Resources
,
using:
::
EE
::
Gitlab
::
Scim
::
User
private
DEFAULT_SCHEMA
=
'urn:ietf:params:scim:api:messages:2.0:ListResponse'
ITEMS_PER_PAGE
=
20
START_INDEX
=
1
def
schemas
[
DEFAULT_SCHEMA
]
end
def
total_results
1
end
def
items_per_page
ITEMS_PER_PAGE
end
def
start_index
START_INDEX
end
# We only support a single resource at the moment
# Please update `total_results` to `resources.count` once this changes
def
resources
[
object
]
end
end
end
end
end
ee/spec/lib/gitlab/scim/users_spec.rb
0 → 100644
View file @
92dc05c4
# frozen_string_literal: true
require
'spec_helper'
describe
::
EE
::
Gitlab
::
Scim
::
Users
do
let
(
:user
)
{
build
(
:user
)
}
let
(
:identity
)
{
build
(
:group_saml_identity
,
user:
user
)
}
let
(
:entity
)
do
described_class
.
new
(
identity
)
end
subject
{
entity
.
as_json
}
it
'contains the schemas'
do
expect
(
subject
[
:schemas
]).
to
eq
([
'urn:ietf:params:scim:api:messages:2.0:ListResponse'
])
end
it
'contains the totalResults'
do
expect
(
subject
[
:totalResults
]).
to
eq
(
1
)
end
it
'contains the itemsPerPage'
do
expect
(
subject
[
:itemsPerPage
]).
to
eq
(
20
)
end
it
'contains the startIndex'
do
expect
(
subject
[
:startIndex
]).
to
eq
(
1
)
end
it
'contains the user'
do
expect
(
subject
[
:Resources
]).
not_to
be_empty
end
it
'contains the user ID'
do
expect
(
subject
[
:Resources
].
first
[
:id
]).
to
eq
(
identity
.
extern_uid
)
end
end
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