User's blocked field refactored to use state machine

This commit is contained in:
Andrew8xx8 2013-03-04 18:52:30 +04:00
parent 9a06dd4aa1
commit 0d9a6fe7b1
12 changed files with 40 additions and 33 deletions

View file

@ -2,11 +2,11 @@ module Gitlab
module Entities
class User < Grape::Entity
expose :id, :username, :email, :name, :bio, :skype, :linkedin, :twitter,
:dark_scheme, :theme_id, :blocked, :created_at, :extern_uid, :provider
:dark_scheme, :theme_id, :state, :created_at, :extern_uid, :provider
end
class UserBasic < Grape::Entity
expose :id, :username, :email, :name, :blocked, :created_at
expose :id, :username, :email, :name, :state, :created_at
end
class UserLogin < UserBasic

View file

@ -41,10 +41,12 @@ module Gitlab
password_confirmation: password,
projects_limit: Gitlab.config.gitlab.default_projects_limit,
}, as: :admin)
if Gitlab.config.omniauth['block_auto_created_users'] && !ldap
@user.blocked = true
end
@user.save!
if Gitlab.config.omniauth['block_auto_created_users'] && !ldap
@user.block
end
@user
end