mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Merge remote-tracking branch 'upstream/master' into postgres-query-builder
This commit is contained in:
commit
bb68cb6e3c
@ -363,10 +363,10 @@ func GetFoldersForSignedInUser(query *m.GetFoldersForSignedInUserQuery) error {
|
|||||||
|
|
||||||
if query.SignedInUser.OrgRole == m.ROLE_ADMIN {
|
if query.SignedInUser.OrgRole == m.ROLE_ADMIN {
|
||||||
sql := `SELECT distinct d.id, d.title
|
sql := `SELECT distinct d.id, d.title
|
||||||
FROM dashboard AS d WHERE d.is_folder = ?
|
FROM dashboard AS d WHERE d.is_folder = ? AND d.org_id = ?
|
||||||
ORDER BY d.title ASC`
|
ORDER BY d.title ASC`
|
||||||
|
|
||||||
err = x.Sql(sql, dialect.BooleanStr(true)).Find(&query.Result)
|
err = x.Sql(sql, dialect.BooleanStr(true), query.OrgId).Find(&query.Result)
|
||||||
} else {
|
} else {
|
||||||
params := make([]interface{}, 0)
|
params := make([]interface{}, 0)
|
||||||
sql := `SELECT distinct d.id, d.title
|
sql := `SELECT distinct d.id, d.title
|
||||||
|
@ -219,13 +219,14 @@ func TestDashboardFolderDataAccess(t *testing.T) {
|
|||||||
|
|
||||||
folder1 := insertTestDashboard("1 test dash folder", 1, 0, true, "prod")
|
folder1 := insertTestDashboard("1 test dash folder", 1, 0, true, "prod")
|
||||||
folder2 := insertTestDashboard("2 test dash folder", 1, 0, true, "prod")
|
folder2 := insertTestDashboard("2 test dash folder", 1, 0, true, "prod")
|
||||||
|
insertTestDashboard("folder in another org", 2, 0, true, "prod")
|
||||||
|
|
||||||
adminUser := createUser("admin", "Admin", true)
|
adminUser := createUser("admin", "Admin", true)
|
||||||
editorUser := createUser("editor", "Editor", false)
|
editorUser := createUser("editor", "Editor", false)
|
||||||
viewerUser := createUser("viewer", "Viewer", false)
|
viewerUser := createUser("viewer", "Viewer", false)
|
||||||
|
|
||||||
Convey("Admin users", func() {
|
Convey("Admin users", func() {
|
||||||
Convey("Should have write access to all dashboard folders", func() {
|
Convey("Should have write access to all dashboard folders in their org", func() {
|
||||||
query := m.GetFoldersForSignedInUserQuery{
|
query := m.GetFoldersForSignedInUserQuery{
|
||||||
OrgId: 1,
|
OrgId: 1,
|
||||||
SignedInUser: &m.SignedInUser{UserId: adminUser.Id, OrgRole: m.ROLE_ADMIN},
|
SignedInUser: &m.SignedInUser{UserId: adminUser.Id, OrgRole: m.ROLE_ADMIN},
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import appEvents from 'app/core/app_events';
|
import appEvents from 'app/core/app_events';
|
||||||
|
import locationUtil from 'app/core/utils/location_util';
|
||||||
|
|
||||||
export class CreateFolderCtrl {
|
export class CreateFolderCtrl {
|
||||||
title = '';
|
title = '';
|
||||||
@ -19,7 +20,7 @@ export class CreateFolderCtrl {
|
|||||||
|
|
||||||
return this.backendSrv.createDashboardFolder(this.title).then(result => {
|
return this.backendSrv.createDashboardFolder(this.title).then(result => {
|
||||||
appEvents.emit('alert-success', ['Folder Created', 'OK']);
|
appEvents.emit('alert-success', ['Folder Created', 'OK']);
|
||||||
this.$location.url(result.meta.url);
|
this.$location.url(locationUtil.stripBaseFromUrl(result.meta.url));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user