Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
nexpie-grafana-theme
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Registry
Registry
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kornkitt Poolsup
nexpie-grafana-theme
Commits
eb970a49
Unverified
Commit
eb970a49
authored
Sep 14, 2020
by
Agnès Toulet
Committed by
GitHub
Sep 14, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Org API: enrich add user to org endpoints with user ID in the response (#27551)
parent
8759a912
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
5 deletions
+15
-5
docs/sources/http_api/org.md
+2
-2
pkg/api/org_invite.go
+4
-1
pkg/api/org_users.go
+9
-2
No files found.
docs/sources/http_api/org.md
View file @
eb970a49
...
...
@@ -212,7 +212,7 @@ Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk
HTTP/1.1 200
Content-Type: application/json
{"message":"User added to organization"}
{"message":"User added to organization"
,"userId":1
}
```
## Admin Organizations API
...
...
@@ -463,7 +463,7 @@ Content-Type: application/json
HTTP/1.1 200
Content-Type: application/json
{"message":"User added to organization"}
{"message":"User added to organization"
, "userId": 1
}
```
### Update Users in Organization
...
...
pkg/api/org_invite.go
View file @
eb970a49
...
...
@@ -123,7 +123,10 @@ func inviteExistingUserToOrg(c *models.ReqContext, user *models.User, inviteDto
}
}
return
Success
(
fmt
.
Sprintf
(
"Existing Grafana user %s added to org %s"
,
user
.
NameOrFallback
(),
c
.
OrgName
))
return
JSON
(
200
,
util
.
DynMap
{
"message"
:
fmt
.
Sprintf
(
"Existing Grafana user %s added to org %s"
,
user
.
NameOrFallback
(),
c
.
OrgName
),
"userId"
:
user
.
Id
,
})
}
func
RevokeInvite
(
c
*
models
.
ReqContext
)
Response
{
...
...
pkg/api/org_users.go
View file @
eb970a49
...
...
@@ -4,6 +4,7 @@ import (
"github.com/grafana/grafana/pkg/api/dtos"
"github.com/grafana/grafana/pkg/bus"
"github.com/grafana/grafana/pkg/models"
"github.com/grafana/grafana/pkg/util"
)
// POST /api/org/users
...
...
@@ -35,12 +36,18 @@ func addOrgUserHelper(cmd models.AddOrgUserCommand) Response {
if
err
:=
bus
.
Dispatch
(
&
cmd
);
err
!=
nil
{
if
err
==
models
.
ErrOrgUserAlreadyAdded
{
return
Error
(
409
,
"User is already member of this organization"
,
nil
)
return
JSON
(
409
,
util
.
DynMap
{
"message"
:
"User is already member of this organization"
,
"userId"
:
cmd
.
UserId
,
})
}
return
Error
(
500
,
"Could not add user to organization"
,
err
)
}
return
Success
(
"User added to organization"
)
return
JSON
(
200
,
util
.
DynMap
{
"message"
:
"User added to organization"
,
"userId"
:
cmd
.
UserId
,
})
}
// GET /api/org/users
...
...
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