Expose user location in API
This commit is contained in:
parent
1749bd3b46
commit
62b6963255
|
@ -23,6 +23,7 @@ v 8.7.0 (unreleased)
|
|||
- Improved UX of the navigation sidebar
|
||||
- Build status notifications
|
||||
- API: Ability to retrieve a specific tag (Robert Schilling)
|
||||
- API: Expose user location (Robert Schilling)
|
||||
|
||||
v 8.6.5 (unreleased)
|
||||
- Check permissions when user attempts to import members from another project
|
||||
|
|
|
@ -69,6 +69,7 @@ GET /users
|
|||
"state": "blocked",
|
||||
"created_at": "2012-05-23T08:01:01Z",
|
||||
"bio": null,
|
||||
"location": null,
|
||||
"skype": "",
|
||||
"linkedin": "",
|
||||
"twitter": "",
|
||||
|
@ -126,6 +127,7 @@ Parameters:
|
|||
"created_at": "2012-05-23T08:00:58Z",
|
||||
"is_admin": false,
|
||||
"bio": null,
|
||||
"location": null,
|
||||
"skype": "",
|
||||
"linkedin": "",
|
||||
"twitter": "",
|
||||
|
@ -154,6 +156,7 @@ Parameters:
|
|||
"confirmed_at": "2012-05-23T08:00:58Z",
|
||||
"last_sign_in_at": "2015-03-23T08:00:58Z",
|
||||
"bio": null,
|
||||
"location": null,
|
||||
"skype": "",
|
||||
"linkedin": "",
|
||||
"twitter": "",
|
||||
|
@ -191,6 +194,7 @@ Parameters:
|
|||
- `extern_uid` (optional) - External UID
|
||||
- `provider` (optional) - External provider name
|
||||
- `bio` (optional) - User's biography
|
||||
- `location` (optional) - User's location
|
||||
- `admin` (optional) - User is admin - true or false (default)
|
||||
- `can_create_group` (optional) - User can create groups - true or false
|
||||
- `confirm` (optional) - Require confirmation - true (default) or false
|
||||
|
@ -218,6 +222,7 @@ Parameters:
|
|||
- `extern_uid` - External UID
|
||||
- `provider` - External provider name
|
||||
- `bio` - User's biography
|
||||
- `location` (optional) - User's location
|
||||
- `admin` (optional) - User is admin - true or false (default)
|
||||
- `can_create_group` (optional) - User can create groups - true or false
|
||||
- `external` (optional) - Flags the user as external - true or false(default)
|
||||
|
@ -260,6 +265,7 @@ GET /user
|
|||
"state": "active",
|
||||
"created_at": "2012-05-23T08:00:58Z",
|
||||
"bio": null,
|
||||
"location": null,
|
||||
"skype": "",
|
||||
"linkedin": "",
|
||||
"twitter": "",
|
||||
|
|
|
@ -15,7 +15,7 @@ module API
|
|||
class User < UserBasic
|
||||
expose :created_at
|
||||
expose :is_admin?, as: :is_admin
|
||||
expose :bio, :skype, :linkedin, :twitter, :website_url
|
||||
expose :bio, :location, :skype, :linkedin, :twitter, :website_url
|
||||
end
|
||||
|
||||
class Identity < Grape::Entity
|
||||
|
|
|
@ -58,6 +58,7 @@ module API
|
|||
# extern_uid - External authentication provider UID
|
||||
# provider - External provider
|
||||
# bio - Bio
|
||||
# location - Location of the user
|
||||
# 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
|
||||
|
@ -67,7 +68,7 @@ module API
|
|||
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, :external]
|
||||
attrs = attributes_for_keys [:email, :name, :password, :skype, :linkedin, :twitter, :projects_limit, :username, :bio, :location, :can_create_group, :admin, :confirm, :external]
|
||||
admin = attrs.delete(:admin)
|
||||
confirm = !(attrs.delete(:confirm) =~ (/(false|f|no|0)$/i))
|
||||
user = User.build_user(attrs)
|
||||
|
@ -106,6 +107,7 @@ module API
|
|||
# website_url - Website url
|
||||
# projects_limit - Limit projects each user can create
|
||||
# bio - Bio
|
||||
# location - Location of the user
|
||||
# admin - User is admin - true or false (default)
|
||||
# can_create_group - User can create groups - true or false
|
||||
# external - Flags the user as external - true or false(default)
|
||||
|
@ -114,7 +116,7 @@ module API
|
|||
put ":id" do
|
||||
authenticated_as_admin!
|
||||
|
||||
attrs = attributes_for_keys [:email, :name, :password, :skype, :linkedin, :twitter, :website_url, :projects_limit, :username, :bio, :can_create_group, :admin, :external]
|
||||
attrs = attributes_for_keys [:email, :name, :password, :skype, :linkedin, :twitter, :website_url, :projects_limit, :username, :bio, :location, :can_create_group, :admin, :external]
|
||||
user = User.find(params[:id])
|
||||
not_found!('User') unless user
|
||||
|
||||
|
|
Loading…
Reference in New Issue