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
1cec65d0
Commit
1cec65d0
authored
Feb 25, 2019
by
James Lopez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add email and users entities
parent
a652a631
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
128 additions
and
0 deletions
+128
-0
ee/lib/ee/gitlab/scim/emails.rb
ee/lib/ee/gitlab/scim/emails.rb
+25
-0
ee/lib/ee/gitlab/scim/user.rb
ee/lib/ee/gitlab/scim/user.rb
+43
-0
ee/spec/lib/gitlab/scim/emails_spec.rb
ee/spec/lib/gitlab/scim/emails_spec.rb
+26
-0
ee/spec/lib/gitlab/scim/user_spec.rb
ee/spec/lib/gitlab/scim/user_spec.rb
+34
-0
No files found.
ee/lib/ee/gitlab/scim/emails.rb
0 → 100644
View file @
1cec65d0
# frozen_string_literal: true
module
EE
module
Gitlab
module
Scim
class
Emails
<
Grape
::
Entity
expose
:type
expose
:value
do
|
user
,
_options
|
user
.
email
end
expose
:primary
private
def
type
'work'
end
def
primary
true
end
end
end
end
end
ee/lib/ee/gitlab/scim/user.rb
0 → 100644
View file @
1cec65d0
# frozen_string_literal: true
module
EE
module
Gitlab
module
Scim
class
User
<
Grape
::
Entity
expose
:schemas
expose
:extern_uid
,
as: :id
expose
:active
expose
'name.formatted'
do
|
identity
,
_options
|
identity
.
user
.
name
end
present_collection
true
,
:email
expose
:email_user
,
as: :emails
,
using:
'::EE::Gitlab::Scim::Emails'
private
def
schemas
[
"urn:ietf:params:scim:schemas:core:2.0:User"
]
end
def
active
# We don't block the user yet when deprovisioning
# So the user is always active, until the identity link is removed.
true
end
def
email_type
'work'
end
def
email_primary
true
end
def
email_user
[
object
.
user
]
end
end
end
end
end
ee/spec/lib/gitlab/scim/emails_spec.rb
0 → 100644
View file @
1cec65d0
# frozen_string_literal: true
require
'spec_helper'
describe
::
EE
::
Gitlab
::
Scim
::
Emails
do
let
(
:user
)
{
create
(
:user
)
}
let
(
:identity
)
{
create
(
:group_saml_identity
,
user:
user
)
}
let
(
:entity
)
do
described_class
.
new
(
user
)
end
subject
{
entity
.
as_json
}
it
'contains the email'
do
expect
(
subject
[
:value
]).
to
eq
(
user
.
email
)
end
it
'contains the type'
do
expect
(
subject
[
:type
]).
to
eq
(
'work'
)
end
it
'contains the email'
do
expect
(
subject
[
:primary
]).
to
be
true
end
end
ee/spec/lib/gitlab/scim/user_spec.rb
0 → 100644
View file @
1cec65d0
# frozen_string_literal: true
require
'spec_helper'
describe
::
EE
::
Gitlab
::
Scim
::
User
do
let
(
:user
)
{
create
(
:user
)
}
let
(
:identity
)
{
create
(
: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:schemas:core:2.0:User"
])
end
it
'contains the extern UID'
do
expect
(
subject
[
:id
]).
to
eq
(
identity
.
extern_uid
)
end
it
'contains the active flag'
do
expect
(
subject
[
:active
]).
to
be
true
end
it
'contains the name'
do
expect
(
subject
[
:'name.formatted'
]).
to
eq
(
user
.
name
)
end
it
'contains the email'
do
expect
(
subject
[
:emails
].
first
[
:value
]).
to
eq
(
user
.
email
)
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