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
e174f7c2
Commit
e174f7c2
authored
Mar 05, 2019
by
Leonard Gram
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
folders: admin for created folders
parent
e294252e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
40 additions
and
0 deletions
+40
-0
pkg/services/dashboards/folder_service.go
+40
-0
No files found.
pkg/services/dashboards/folder_service.go
View file @
e174f7c2
...
...
@@ -5,6 +5,7 @@ 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
...
...
@@ -114,6 +115,45 @@ 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