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
da3dcd19
Commit
da3dcd19
authored
Mar 05, 2019
by
Leonard Gram
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
folder: uses service to make user admin of created folder.
parent
c8c00409
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
40 deletions
+5
-40
pkg/api/folder.go
+5
-0
pkg/services/dashboards/folder_service.go
+0
-40
No files found.
pkg/api/folder.go
View file @
da3dcd19
...
...
@@ -61,6 +61,11 @@ func (hs *HTTPServer) CreateFolder(c *m.ReqContext, cmd m.CreateFolderCommand) R
return
toFolderError
(
err
)
}
if
hs
.
Cfg
.
EditorsCanOwn
{
aclService
:=
dashboards
.
NewAclService
()
aclService
.
MakeUserAdmin
(
c
.
OrgId
,
c
.
SignedInUser
.
UserId
,
cmd
.
Result
.
Id
)
}
g
:=
guardian
.
New
(
cmd
.
Result
.
Id
,
c
.
OrgId
,
c
.
SignedInUser
)
return
JSON
(
200
,
toFolderDto
(
g
,
cmd
.
Result
))
}
...
...
pkg/services/dashboards/folder_service.go
View file @
da3dcd19
...
...
@@ -5,7 +5,6 @@ import (
"github.com/grafana/grafana/pkg/models"
"github.com/grafana/grafana/pkg/services/guardian"
"github.com/grafana/grafana/pkg/services/search"
"time"
)
// FolderService service for operating on folders
...
...
@@ -115,45 +114,6 @@ func (dr *dashboardServiceImpl) CreateFolder(cmd *models.CreateFolderCommand) er
return
toFolderError
(
err
)
}
rtEditor
:=
models
.
ROLE_EDITOR
rtViewer
:=
models
.
ROLE_VIEWER
items
:=
[]
*
models
.
DashboardAcl
{
{
OrgId
:
dr
.
orgId
,
DashboardId
:
saveDashboardCmd
.
Result
.
Id
,
UserId
:
saveDashboardCmd
.
Result
.
CreatedBy
,
Permission
:
models
.
PERMISSION_ADMIN
,
Created
:
time
.
Now
(),
Updated
:
time
.
Now
(),
},
{
OrgId
:
dr
.
orgId
,
DashboardId
:
saveDashboardCmd
.
Result
.
Id
,
Role
:
&
rtEditor
,
Permission
:
models
.
PERMISSION_EDIT
,
Created
:
time
.
Now
(),
Updated
:
time
.
Now
(),
},
{
OrgId
:
dr
.
orgId
,
DashboardId
:
saveDashboardCmd
.
Result
.
Id
,
Role
:
&
rtViewer
,
Permission
:
models
.
PERMISSION_VIEW
,
Created
:
time
.
Now
(),
Updated
:
time
.
Now
(),
},
}
aclCmd
:=
&
models
.
UpdateDashboardAclCommand
{
DashboardId
:
saveDashboardCmd
.
Result
.
Id
,
Items
:
items
,
}
if
err
=
bus
.
Dispatch
(
aclCmd
);
err
!=
nil
{
return
err
}
query
:=
models
.
GetDashboardQuery
{
OrgId
:
dr
.
orgId
,
Id
:
saveDashboardCmd
.
Result
.
Id
}
dashFolder
,
err
=
getFolder
(
query
)
if
err
!=
nil
{
...
...
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