Commit 446104d1 by Daniel Lee

dashfolders: allows phantomjs rendering for alerting

Makes the alerting user an admin when rendering a png
for emails
parent 691ff32a
...@@ -29,6 +29,7 @@ type RenderOpts struct { ...@@ -29,6 +29,7 @@ type RenderOpts struct {
UserId int64 UserId int64
OrgRole models.RoleType OrgRole models.RoleType
Timezone string Timezone string
IsAlertContext bool
} }
var rendererLog log.Logger = log.New("png-renderer") var rendererLog log.Logger = log.New("png-renderer")
...@@ -75,7 +76,11 @@ func RenderToPng(params *RenderOpts) (string, error) { ...@@ -75,7 +76,11 @@ func RenderToPng(params *RenderOpts) (string, error) {
pngPath, _ := filepath.Abs(filepath.Join(setting.ImagesDir, util.GetRandomString(20))) pngPath, _ := filepath.Abs(filepath.Join(setting.ImagesDir, util.GetRandomString(20)))
pngPath = pngPath + ".png" pngPath = pngPath + ".png"
renderKey := middleware.AddRenderAuthKey(params.OrgId, params.UserId, params.OrgRole) orgRole := params.OrgRole
if params.IsAlertContext {
orgRole = models.ROLE_ADMIN
}
renderKey := middleware.AddRenderAuthKey(params.OrgId, params.UserId, orgRole)
defer middleware.RemoveRenderAuthKey(renderKey) defer middleware.RemoveRenderAuthKey(renderKey)
cmdArgs := []string{ cmdArgs := []string{
......
...@@ -83,6 +83,7 @@ func (n *notificationService) uploadImage(context *EvalContext) (err error) { ...@@ -83,6 +83,7 @@ func (n *notificationService) uploadImage(context *EvalContext) (err error) {
Height: "400", Height: "400",
Timeout: "30", Timeout: "30",
OrgId: context.Rule.OrgId, OrgId: context.Rule.OrgId,
IsAlertContext: true,
} }
if slug, err := context.GetDashboardSlug(); err != nil { if slug, err := context.GetDashboardSlug(); err != nil {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment