summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorZeger-Jan van de Weg <zegerjan@gitlab.com>2016-03-10 22:08:11 +0100
committerZeger-Jan van de Weg <zegerjan@gitlab.com>2016-03-13 19:08:04 +0100
commit42fcd3881fcece5c9bd4b720460d6cade573b151 (patch)
treeacabaaa610da27413ffdd7b5a0dd1610d3772a4c /lib
parent065de4ab791373f7e6b8b5d3b73b5fe7c9e8e7c5 (diff)
downloadgitlab-ce-42fcd3881fcece5c9bd4b720460d6cade573b151.tar.gz
External Users
The user has the rights of a public user execpt it can never create a project, group, or team. Also it cant view internal projects.
Diffstat (limited to 'lib')
-rw-r--r--lib/api/users.rb5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/api/users.rb b/lib/api/users.rb
index fd2128bd179..c574f042a66 100644
--- a/lib/api/users.rb
+++ b/lib/api/users.rb
@@ -61,19 +61,20 @@ module API
# admin - User is admin - true or false (default)
# can_create_group - User can create groups - true or false
# confirm - Require user confirmation - true (default) or false
+ # external - Is user an external user - true or false(default)
# Example Request:
# POST /users
post do
authenticated_as_admin!
required_attributes! [:email, :password, :name, :username]
- attrs = attributes_for_keys [:email, :name, :password, :skype, :linkedin, :twitter, :projects_limit, :username, :bio, :can_create_group, :admin, :confirm]
+ attrs = attributes_for_keys [:email, :name, :password, :skype, :linkedin, :twitter, :projects_limit, :username, :bio, :can_create_group, :admin, :confirm, :external]
admin = attrs.delete(:admin)
confirm = !(attrs.delete(:confirm) =~ (/(false|f|no|0)$/i))
user = User.build_user(attrs)
user.admin = admin unless admin.nil?
user.skip_confirmation! unless confirm
-
identity_attrs = attributes_for_keys [:provider, :extern_uid]
+
if identity_attrs.any?
user.identities.build(identity_attrs)
end