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
beddfdd8
Unverified
Commit
beddfdd8
authored
Aug 08, 2018
by
Marcus Efraimsson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add api route for retrieving teams of signed in user
parent
b0ddc15e
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
49 additions
and
0 deletions
+49
-0
docs/sources/http_api/user.md
+33
-0
pkg/api/api.go
+1
-0
pkg/api/user.go
+15
-0
No files found.
docs/sources/http_api/user.md
View file @
beddfdd8
...
...
@@ -363,6 +363,39 @@ Content-Type: application/json
]
```
## Teams that the actual User is member of
`GET /api/user/teams`
Return a list of all teams that the current user is member of.
**Example Request**
:
```
http
GET
/api/user/teams
HTTP
/
1.1
Accept
:
application/json
Content-Type
:
application/json
Authorization
:
Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk
```
**Example Response**
:
```
http
HTTP/1.1 200
Content-Type: application/json
[
{
"id": 1,
"orgId": 1,
"name": "MyTestTeam",
"email": "",
"avatarUrl": "\/avatar\/3f49c15916554246daa714b9bd0ee398",
"memberCount": 1
}
]
```
## Star a dashboard
`POST /api/user/stars/dashboard/:dashboardId`
...
...
pkg/api/api.go
View file @
beddfdd8
...
...
@@ -120,6 +120,7 @@ func (hs *HTTPServer) registerRoutes() {
userRoute
.
Put
(
"/"
,
bind
(
m
.
UpdateUserCommand
{}),
Wrap
(
UpdateSignedInUser
))
userRoute
.
Post
(
"/using/:id"
,
Wrap
(
UserSetUsingOrg
))
userRoute
.
Get
(
"/orgs"
,
Wrap
(
GetSignedInUserOrgList
))
userRoute
.
Get
(
"/teams"
,
Wrap
(
GetSignedInUserTeamList
))
userRoute
.
Post
(
"/stars/dashboard/:id"
,
Wrap
(
StarDashboard
))
userRoute
.
Delete
(
"/stars/dashboard/:id"
,
Wrap
(
UnstarDashboard
))
...
...
pkg/api/user.go
View file @
beddfdd8
...
...
@@ -111,6 +111,21 @@ func GetSignedInUserOrgList(c *m.ReqContext) Response {
return
getUserOrgList
(
c
.
UserId
)
}
// GET /api/user/teams
func
GetSignedInUserTeamList
(
c
*
m
.
ReqContext
)
Response
{
query
:=
m
.
GetTeamsByUserQuery
{
OrgId
:
c
.
OrgId
,
UserId
:
c
.
UserId
}
if
err
:=
bus
.
Dispatch
(
&
query
);
err
!=
nil
{
return
Error
(
500
,
"Failed to get user teams"
,
err
)
}
for
_
,
team
:=
range
query
.
Result
{
team
.
AvatarUrl
=
dtos
.
GetGravatarUrlWithDefault
(
team
.
Email
,
team
.
Name
)
}
return
JSON
(
200
,
query
.
Result
)
}
// GET /api/user/:id/orgs
func
GetUserOrgList
(
c
*
m
.
ReqContext
)
Response
{
return
getUserOrgList
(
c
.
ParamsInt64
(
":id"
))
...
...
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