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
0
Merge Requests
0
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
Kazuhiko Shiozaki
gitlab-ce
Commits
ac6a10f3
Commit
ac6a10f3
authored
Jan 12, 2016
by
Gabriel Mazetto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Codestyle changes
parent
47e4613f
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
6 additions
and
6 deletions
+6
-6
app/models/identity.rb
app/models/identity.rb
+1
-1
lib/api/users.rb
lib/api/users.rb
+3
-3
spec/models/identity_spec.rb
spec/models/identity_spec.rb
+2
-2
No files found.
app/models/identity.rb
View file @
ac6a10f3
...
@@ -19,7 +19,7 @@ class Identity < ActiveRecord::Base
...
@@ -19,7 +19,7 @@ class Identity < ActiveRecord::Base
validates
:extern_uid
,
allow_blank:
true
,
uniqueness:
{
scope: :provider
}
validates
:extern_uid
,
allow_blank:
true
,
uniqueness:
{
scope: :provider
}
validates
:user_id
,
uniqueness:
{
scope: :provider
}
validates
:user_id
,
uniqueness:
{
scope: :provider
}
def
is_
ldap?
def
ldap?
provider
.
starts_with?
(
'ldap'
)
provider
.
starts_with?
(
'ldap'
)
end
end
end
end
lib/api/users.rb
View file @
ac6a10f3
...
@@ -303,10 +303,10 @@ module API
...
@@ -303,10 +303,10 @@ module API
if
!
user
if
!
user
not_found!
(
'User'
)
not_found!
(
'User'
)
elsif
!
user
.
ldap_blocked?
elsif
user
.
ldap_blocked?
user
.
activate
else
forbidden!
(
'LDAP blocked users cannot be unblocked by the API'
)
forbidden!
(
'LDAP blocked users cannot be unblocked by the API'
)
else
user
.
activate
end
end
end
end
end
end
...
...
spec/models/identity_spec.rb
View file @
ac6a10f3
...
@@ -28,11 +28,11 @@ RSpec.describe Identity, models: true do
...
@@ -28,11 +28,11 @@ RSpec.describe Identity, models: true do
let
(
:other_identity
)
{
create
(
:identity
,
provider:
'twitter'
)
}
let
(
:other_identity
)
{
create
(
:identity
,
provider:
'twitter'
)
}
it
'returns true if it is a ldap identity'
do
it
'returns true if it is a ldap identity'
do
expect
(
ldap_identity
.
is_
ldap?
).
to
be_truthy
expect
(
ldap_identity
.
ldap?
).
to
be_truthy
end
end
it
'returns false if it is not a ldap identity'
do
it
'returns false if it is not a ldap identity'
do
expect
(
other_identity
.
is_
ldap?
).
to
be_falsey
expect
(
other_identity
.
ldap?
).
to
be_falsey
end
end
end
end
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