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
e294252e
Commit
e294252e
authored
Mar 05, 2019
by
Leonard Gram
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dashboards: user automatically becomes admin for created dashboards
parent
abbb7b81
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
43 additions
and
0 deletions
+43
-0
pkg/services/dashboards/dashboard_service.go
+43
-0
No files found.
pkg/services/dashboards/dashboard_service.go
View file @
e294252e
...
...
@@ -238,6 +238,49 @@ func (dr *dashboardServiceImpl) SaveDashboard(dto *SaveDashboardDTO) (*models.Da
return
nil
,
err
}
// TODO: check if dashboard exists already. could have id set but not exist
if
dto
.
Dashboard
.
Id
==
0
&&
dto
.
Dashboard
.
Uid
==
""
{
rtEditor
:=
models
.
ROLE_EDITOR
rtViewer
:=
models
.
ROLE_VIEWER
items
:=
[]
*
models
.
DashboardAcl
{
{
OrgId
:
dr
.
orgId
,
DashboardId
:
cmd
.
Result
.
Id
,
UserId
:
cmd
.
Result
.
CreatedBy
,
Permission
:
models
.
PERMISSION_ADMIN
,
Created
:
time
.
Now
(),
Updated
:
time
.
Now
(),
},
{
OrgId
:
dr
.
orgId
,
DashboardId
:
cmd
.
Result
.
Id
,
Role
:
&
rtEditor
,
Permission
:
models
.
PERMISSION_EDIT
,
Created
:
time
.
Now
(),
Updated
:
time
.
Now
(),
},
{
OrgId
:
dr
.
orgId
,
DashboardId
:
cmd
.
Result
.
Id
,
Role
:
&
rtViewer
,
Permission
:
models
.
PERMISSION_VIEW
,
Created
:
time
.
Now
(),
Updated
:
time
.
Now
(),
},
}
aclCmd
:=
&
models
.
UpdateDashboardAclCommand
{
DashboardId
:
cmd
.
Result
.
Id
,
Items
:
items
,
}
if
err
=
bus
.
Dispatch
(
aclCmd
);
err
!=
nil
{
return
cmd
.
Result
,
err
}
}
return
cmd
.
Result
,
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