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
370589d6
Commit
370589d6
authored
Apr 09, 2016
by
Torkel Ödegaard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix(org switch): fixed issue with switching orgs, fixes #4614
parent
262c341b
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
21 additions
and
3 deletions
+21
-3
pkg/api/api.go
+1
-0
pkg/api/user.go
+18
-0
public/app/core/components/sidemenu/sidemenu.ts
+2
-3
No files found.
pkg/api/api.go
View file @
370589d6
...
...
@@ -30,6 +30,7 @@ func Register(r *macaron.Macaron) {
// authed views
r
.
Get
(
"/profile/"
,
reqSignedIn
,
Index
)
r
.
Get
(
"/profile/password"
,
reqSignedIn
,
Index
)
r
.
Get
(
"/profile/switch-org/:id"
,
reqSignedIn
,
ChangeActiveOrgAndRedirectToHome
)
r
.
Get
(
"/org/"
,
reqSignedIn
,
Index
)
r
.
Get
(
"/org/new"
,
reqSignedIn
,
Index
)
r
.
Get
(
"/datasources/"
,
reqSignedIn
,
Index
)
...
...
pkg/api/user.go
View file @
370589d6
...
...
@@ -4,6 +4,7 @@ import (
"github.com/grafana/grafana/pkg/bus"
"github.com/grafana/grafana/pkg/middleware"
m
"github.com/grafana/grafana/pkg/models"
"github.com/grafana/grafana/pkg/setting"
"github.com/grafana/grafana/pkg/util"
)
...
...
@@ -109,6 +110,23 @@ func UserSetUsingOrg(c *middleware.Context) Response {
return
ApiSuccess
(
"Active organization changed"
)
}
// GET /profile/switch-org/:id
func
ChangeActiveOrgAndRedirectToHome
(
c
*
middleware
.
Context
)
{
orgId
:=
c
.
ParamsInt64
(
":id"
)
if
!
validateUsingOrg
(
c
.
UserId
,
orgId
)
{
NotFoundHandler
(
c
)
}
cmd
:=
m
.
SetUsingOrgCommand
{
UserId
:
c
.
UserId
,
OrgId
:
orgId
}
if
err
:=
bus
.
Dispatch
(
&
cmd
);
err
!=
nil
{
NotFoundHandler
(
c
)
}
c
.
Redirect
(
setting
.
AppSubUrl
+
"/"
)
}
func
ChangeUserPassword
(
c
*
middleware
.
Context
,
cmd
m
.
ChangeUserPasswordCommand
)
Response
{
userQuery
:=
m
.
GetUserByIdQuery
{
Id
:
c
.
UserId
}
...
...
public/app/core/components/sidemenu/sidemenu.ts
View file @
370589d6
...
...
@@ -72,9 +72,8 @@ export class SideMenuCtrl {
this
.
orgMenu
.
push
({
text
:
"Switch to "
+
org
.
name
,
icon
:
"fa fa-fw fa-random"
,
click
:
()
=>
{
this
.
switchOrg
(
org
.
orgId
);
}
url
:
this
.
getUrl
(
'/profile/switch-org/'
+
org
.
orgId
),
target
:
'_self'
});
});
...
...
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