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
fb5c59c6
Commit
fb5c59c6
authored
Nov 19, 2018
by
supercharlesliu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add GET /api/users/:id/teams for orgAdmin
parent
435079c6
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
3 deletions
+12
-3
pkg/api/api.go
+1
-0
pkg/api/user.go
+11
-3
No files found.
pkg/api/api.go
View file @
fb5c59c6
...
...
@@ -140,6 +140,7 @@ func (hs *HTTPServer) registerRoutes() {
usersRoute
.
Get
(
"/"
,
Wrap
(
SearchUsers
))
usersRoute
.
Get
(
"/search"
,
Wrap
(
SearchUsersWithPaging
))
usersRoute
.
Get
(
"/:id"
,
Wrap
(
GetUserByID
))
usersRoute
.
Get
(
"/:id/teams"
,
Wrap
(
GetUserTeams
))
usersRoute
.
Get
(
"/:id/orgs"
,
Wrap
(
GetUserOrgList
))
// query parameters /users/lookup?loginOrEmail=admin@example.com
usersRoute
.
Get
(
"/lookup"
,
Wrap
(
GetUserByLoginOrEmail
))
...
...
pkg/api/user.go
View file @
fb5c59c6
...
...
@@ -113,7 +113,16 @@ func GetSignedInUserOrgList(c *m.ReqContext) Response {
// GET /api/user/teams
func
GetSignedInUserTeamList
(
c
*
m
.
ReqContext
)
Response
{
query
:=
m
.
GetTeamsByUserQuery
{
OrgId
:
c
.
OrgId
,
UserId
:
c
.
UserId
}
return
getUserTeamList
(
c
.
OrgId
,
c
.
UserId
)
}
// GET /api/users/:id/teams
func
GetUserTeams
(
c
*
m
.
ReqContext
)
Response
{
return
getUserTeamList
(
c
.
OrgId
,
c
.
ParamsInt64
(
"id"
))
}
func
getUserTeamList
(
userID
int64
,
orgID
int64
)
Response
{
query
:=
m
.
GetTeamsByUserQuery
{
OrgId
:
orgID
,
UserId
:
userID
}
if
err
:=
bus
.
Dispatch
(
&
query
);
err
!=
nil
{
return
Error
(
500
,
"Failed to get user teams"
,
err
)
...
...
@@ -122,11 +131,10 @@ func GetSignedInUserTeamList(c *m.ReqContext) Response {
for
_
,
team
:=
range
query
.
Result
{
team
.
AvatarUrl
=
dtos
.
GetGravatarUrlWithDefault
(
team
.
Email
,
team
.
Name
)
}
return
JSON
(
200
,
query
.
Result
)
}
// GET /api/user/:id/orgs
// GET /api/user
s
/: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