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
c970e827
Commit
c970e827
authored
Jan 17, 2015
by
Torkel Ödegaard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Small update to update account command
parent
1532eb42
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
6 additions
and
11 deletions
+6
-11
grafana
+1
-1
pkg/api/account.go
+1
-8
pkg/api/api.go
+1
-1
pkg/middleware/middleware.go
+1
-0
pkg/models/account.go
+2
-1
No files found.
grafana
@
a0036179
Subproject commit
64f98d2409152a2bfa34b6f032d21e6bb18b97f8
Subproject commit
a0036179d500366e28552d2c332fd50f534913a3
pkg/api/account.go
View file @
c970e827
...
@@ -18,14 +18,7 @@ func GetAccount(c *middleware.Context) {
...
@@ -18,14 +18,7 @@ func GetAccount(c *middleware.Context) {
c
.
JSON
(
200
,
query
.
Result
)
c
.
JSON
(
200
,
query
.
Result
)
}
}
func
UpdateAccount
(
c
*
middleware
.
Context
)
{
func
UpdateAccount
(
c
*
middleware
.
Context
,
cmd
m
.
UpdateAccountCommand
)
{
cmd
:=
m
.
UpdateAccountCommand
{}
if
!
c
.
JsonBody
(
&
cmd
)
{
c
.
JsonApiErr
(
400
,
"Invalid request"
,
nil
)
return
}
cmd
.
AccountId
=
c
.
AccountId
cmd
.
AccountId
=
c
.
AccountId
if
err
:=
bus
.
Dispatch
(
&
cmd
);
err
!=
nil
{
if
err
:=
bus
.
Dispatch
(
&
cmd
);
err
!=
nil
{
...
...
pkg/api/api.go
View file @
c970e827
...
@@ -40,7 +40,7 @@ func Register(r *macaron.Macaron) {
...
@@ -40,7 +40,7 @@ func Register(r *macaron.Macaron) {
// account
// account
r
.
Group
(
"/account"
,
func
()
{
r
.
Group
(
"/account"
,
func
()
{
r
.
Get
(
"/"
,
GetAccount
)
r
.
Get
(
"/"
,
GetAccount
)
r
.
Post
(
"/"
,
UpdateAccount
)
r
.
Post
(
"/"
,
bind
(
m
.
UpdateAccountCommand
{}),
UpdateAccount
)
r
.
Put
(
"/collaborators"
,
bind
(
m
.
AddCollaboratorCommand
{}),
AddCollaborator
)
r
.
Put
(
"/collaborators"
,
bind
(
m
.
AddCollaboratorCommand
{}),
AddCollaborator
)
r
.
Get
(
"/collaborators"
,
GetCollaborators
)
r
.
Get
(
"/collaborators"
,
GetCollaborators
)
r
.
Delete
(
"/collaborators/:id"
,
RemoveCollaborator
)
r
.
Delete
(
"/collaborators/:id"
,
RemoveCollaborator
)
...
...
pkg/middleware/middleware.go
View file @
c970e827
...
@@ -58,6 +58,7 @@ func GetContextHandler() macaron.Handler {
...
@@ -58,6 +58,7 @@ func GetContextHandler() macaron.Handler {
// api key role
// api key role
ctx
.
UserRole
=
tokenInfo
.
Role
ctx
.
UserRole
=
tokenInfo
.
Role
ctx
.
ApiKeyId
=
tokenInfo
.
Id
ctx
.
UsingAccountId
=
ctx
.
AccountId
ctx
.
UsingAccountId
=
ctx
.
AccountId
ctx
.
UsingAccountName
=
ctx
.
UserName
ctx
.
UsingAccountName
=
ctx
.
UserName
}
}
...
...
pkg/models/account.go
View file @
c970e827
...
@@ -42,7 +42,7 @@ type CreateAccountCommand struct {
...
@@ -42,7 +42,7 @@ type CreateAccountCommand struct {
}
}
type
UpdateAccountCommand
struct
{
type
UpdateAccountCommand
struct
{
Email
string
`json:"email" binding:"
r
equired"`
Email
string
`json:"email" binding:"
R
equired"`
Login
string
`json:"login"`
Login
string
`json:"login"`
Name
string
`json:"name"`
Name
string
`json:"name"`
...
@@ -100,6 +100,7 @@ type SignedInUser struct {
...
@@ -100,6 +100,7 @@ type SignedInUser struct {
UserLogin
string
UserLogin
string
UserName
string
UserName
string
UserEmail
string
UserEmail
string
ApiKeyId
int64
IsGrafanaAdmin
bool
IsGrafanaAdmin
bool
}
}
...
...
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