Commit a90b3e33 by Hugo Häggmark Committed by Leonard Gram

config: updated feature toggle name

parent a6a3d698
...@@ -259,7 +259,7 @@ external_manage_info = ...@@ -259,7 +259,7 @@ external_manage_info =
viewers_can_edit = false viewers_can_edit = false
# Editors can administrate dashboard, folders and teams they create # Editors can administrate dashboard, folders and teams they create
editors_can_own = false editors_can_admin = false
[auth] [auth]
# Login cookie name # Login cookie name
......
...@@ -239,7 +239,7 @@ log_queries = ...@@ -239,7 +239,7 @@ log_queries =
;viewers_can_edit = false ;viewers_can_edit = false
# Editors can administrate dashboard, folders and teams they create # Editors can administrate dashboard, folders and teams they create
;editors_can_own = false ;editors_can_admin = false
[auth] [auth]
# Login cookie name # Login cookie name
......
...@@ -14,7 +14,7 @@ func (hs *HTTPServer) registerRoutes() { ...@@ -14,7 +14,7 @@ func (hs *HTTPServer) registerRoutes() {
reqGrafanaAdmin := middleware.ReqGrafanaAdmin reqGrafanaAdmin := middleware.ReqGrafanaAdmin
reqEditorRole := middleware.ReqEditorRole reqEditorRole := middleware.ReqEditorRole
reqOrgAdmin := middleware.ReqOrgAdmin reqOrgAdmin := middleware.ReqOrgAdmin
reqAdminOrEditorCanAdmin := middleware.EditorCanAdmin(hs.Cfg.EditorsCanOwn) reqAdminOrEditorCanAdmin := middleware.EditorCanAdmin(hs.Cfg.EditorsCanAdmin)
redirectFromLegacyDashboardURL := middleware.RedirectFromLegacyDashboardURL() redirectFromLegacyDashboardURL := middleware.RedirectFromLegacyDashboardURL()
redirectFromLegacyDashboardSoloURL := middleware.RedirectFromLegacyDashboardSoloURL() redirectFromLegacyDashboardSoloURL := middleware.RedirectFromLegacyDashboardSoloURL()
quota := middleware.Quota(hs.QuotaService) quota := middleware.Quota(hs.QuotaService)
......
...@@ -277,7 +277,7 @@ func (hs *HTTPServer) PostDashboard(c *m.ReqContext, cmd m.SaveDashboardCommand) ...@@ -277,7 +277,7 @@ func (hs *HTTPServer) PostDashboard(c *m.ReqContext, cmd m.SaveDashboardCommand)
return Error(500, "Failed to save dashboard", err) return Error(500, "Failed to save dashboard", err)
} }
if hs.Cfg.EditorsCanOwn && newDashboard { if hs.Cfg.EditorsCanAdmin && newDashboard {
aclService := dashboards.NewAclService() aclService := dashboards.NewAclService()
inFolder := cmd.FolderId > 0 inFolder := cmd.FolderId > 0
err := aclService.MakeUserAdmin(cmd.OrgId, cmd.UserId, dashboard.Id, !inFolder) err := aclService.MakeUserAdmin(cmd.OrgId, cmd.UserId, dashboard.Id, !inFolder)
......
...@@ -973,7 +973,7 @@ func postDashboardScenario(desc string, url string, routePattern string, mock *d ...@@ -973,7 +973,7 @@ func postDashboardScenario(desc string, url string, routePattern string, mock *d
defer bus.ClearBusHandlers() defer bus.ClearBusHandlers()
cfg := setting.NewCfg() cfg := setting.NewCfg()
cfg.EditorsCanOwn = false cfg.EditorsCanAdmin = false
hs := HTTPServer{ hs := HTTPServer{
Bus: bus.GetBus(), Bus: bus.GetBus(),
......
...@@ -61,7 +61,7 @@ func (hs *HTTPServer) CreateFolder(c *m.ReqContext, cmd m.CreateFolderCommand) R ...@@ -61,7 +61,7 @@ func (hs *HTTPServer) CreateFolder(c *m.ReqContext, cmd m.CreateFolderCommand) R
return toFolderError(err) return toFolderError(err)
} }
if hs.Cfg.EditorsCanOwn { if hs.Cfg.EditorsCanAdmin {
aclService := dashboards.NewAclService() aclService := dashboards.NewAclService()
if err := aclService.MakeUserAdmin(c.OrgId, c.SignedInUser.UserId, cmd.Result.Id, true); err != nil { if err := aclService.MakeUserAdmin(c.OrgId, c.SignedInUser.UserId, cmd.Result.Id, true); err != nil {
hs.log.Error("Could not make user admin", "folder", cmd.Result.Title, "user", c.SignedInUser.UserId, "error", err) hs.log.Error("Could not make user admin", "folder", cmd.Result.Title, "user", c.SignedInUser.UserId, "error", err)
......
...@@ -143,7 +143,7 @@ func createFolderScenario(desc string, url string, routePattern string, mock *fa ...@@ -143,7 +143,7 @@ func createFolderScenario(desc string, url string, routePattern string, mock *fa
defer bus.ClearBusHandlers() defer bus.ClearBusHandlers()
cfg := setting.NewCfg() cfg := setting.NewCfg()
cfg.EditorsCanOwn = true cfg.EditorsCanAdmin = true
hs := HTTPServer{ hs := HTTPServer{
Bus: bus.GetBus(), Bus: bus.GetBus(),
......
...@@ -167,7 +167,7 @@ func (hs *HTTPServer) getFrontendSettingsMap(c *m.ReqContext) (map[string]interf ...@@ -167,7 +167,7 @@ func (hs *HTTPServer) getFrontendSettingsMap(c *m.ReqContext) (map[string]interf
"externalUserMngLinkUrl": setting.ExternalUserMngLinkUrl, "externalUserMngLinkUrl": setting.ExternalUserMngLinkUrl,
"externalUserMngLinkName": setting.ExternalUserMngLinkName, "externalUserMngLinkName": setting.ExternalUserMngLinkName,
"viewersCanEdit": setting.ViewersCanEdit, "viewersCanEdit": setting.ViewersCanEdit,
"editorsCanOwn": hs.Cfg.EditorsCanOwn, "editorsCanAdmin": hs.Cfg.EditorsCanAdmin,
"disableSanitizeHtml": hs.Cfg.DisableSanitizeHtml, "disableSanitizeHtml": hs.Cfg.DisableSanitizeHtml,
"buildInfo": map[string]interface{}{ "buildInfo": map[string]interface{}{
"version": setting.BuildVersion, "version": setting.BuildVersion,
......
...@@ -327,7 +327,7 @@ func (hs *HTTPServer) setIndexViewData(c *m.ReqContext) (*dtos.IndexViewData, er ...@@ -327,7 +327,7 @@ func (hs *HTTPServer) setIndexViewData(c *m.ReqContext) (*dtos.IndexViewData, er
}) })
} }
if c.OrgRole == m.ROLE_EDITOR && hs.Cfg.EditorsCanOwn { if c.OrgRole == m.ROLE_EDITOR && hs.Cfg.EditorsCanAdmin {
cfgNode := &dtos.NavLink{ cfgNode := &dtos.NavLink{
Id: "cfg", Id: "cfg",
Text: "Configuration", Text: "Configuration",
......
...@@ -18,7 +18,7 @@ func (hs *HTTPServer) CreateTeam(c *m.ReqContext, cmd m.CreateTeamCommand) Respo ...@@ -18,7 +18,7 @@ func (hs *HTTPServer) CreateTeam(c *m.ReqContext, cmd m.CreateTeamCommand) Respo
return Error(500, "Failed to create Team", err) return Error(500, "Failed to create Team", err)
} }
if c.OrgRole == m.ROLE_EDITOR && hs.Cfg.EditorsCanOwn { if c.OrgRole == m.ROLE_EDITOR && hs.Cfg.EditorsCanAdmin {
addMemberCmd := m.AddTeamMemberCommand{ addMemberCmd := m.AddTeamMemberCommand{
UserId: c.SignedInUser.UserId, UserId: c.SignedInUser.UserId,
OrgId: cmd.OrgId, OrgId: cmd.OrgId,
......
...@@ -239,14 +239,13 @@ type Cfg struct { ...@@ -239,14 +239,13 @@ type Cfg struct {
LoginMaxLifetimeDays int LoginMaxLifetimeDays int
TokenRotationIntervalMinutes int TokenRotationIntervalMinutes int
// User
EditorsCanOwn bool
// Dataproxy // Dataproxy
SendUserHeader bool SendUserHeader bool
// DistributedCache // DistributedCache
RemoteCacheOptions *RemoteCacheOptions RemoteCacheOptions *RemoteCacheOptions
EditorsCanAdmin bool
} }
type CommandLineArgs struct { type CommandLineArgs struct {
...@@ -670,7 +669,7 @@ func (cfg *Cfg) Load(args *CommandLineArgs) error { ...@@ -670,7 +669,7 @@ func (cfg *Cfg) Load(args *CommandLineArgs) error {
ExternalUserMngLinkName = users.Key("external_manage_link_name").String() ExternalUserMngLinkName = users.Key("external_manage_link_name").String()
ExternalUserMngInfo = users.Key("external_manage_info").String() ExternalUserMngInfo = users.Key("external_manage_info").String()
ViewersCanEdit = users.Key("viewers_can_edit").MustBool(false) ViewersCanEdit = users.Key("viewers_can_edit").MustBool(false)
cfg.EditorsCanOwn = users.Key("editors_can_own").MustBool(false) cfg.EditorsCanAdmin = users.Key("editors_can_admin").MustBool(false)
// auth // auth
auth := iniFile.Section("auth") auth := iniFile.Section("auth")
......
...@@ -37,7 +37,7 @@ export class Settings { ...@@ -37,7 +37,7 @@ export class Settings {
passwordHint: any; passwordHint: any;
loginError: any; loginError: any;
viewersCanEdit: boolean; viewersCanEdit: boolean;
editorsCanOwn: boolean; editorsCanAdmin: boolean;
disableSanitizeHtml: boolean; disableSanitizeHtml: boolean;
theme: GrafanaTheme; theme: GrafanaTheme;
...@@ -59,7 +59,7 @@ export class Settings { ...@@ -59,7 +59,7 @@ export class Settings {
isEnterprise: false, isEnterprise: false,
}, },
viewersCanEdit: false, viewersCanEdit: false,
editorsCanOwn: false, editorsCanAdmin: false,
disableSanitizeHtml: false, disableSanitizeHtml: false,
}; };
......
...@@ -93,7 +93,7 @@ export class TeamMembers extends PureComponent<Props, State> { ...@@ -93,7 +93,7 @@ export class TeamMembers extends PureComponent<Props, State> {
</td> </td>
<td>{member.login}</td> <td>{member.login}</td>
<td>{member.email}</td> <td>{member.email}</td>
<WithFeatureToggle featureToggle={config.editorsCanOwn}> <WithFeatureToggle featureToggle={config.editorsCanAdmin}>
<td> <td>
<div className="gf-form"> <div className="gf-form">
<Select <Select
...@@ -161,7 +161,7 @@ export class TeamMembers extends PureComponent<Props, State> { ...@@ -161,7 +161,7 @@ export class TeamMembers extends PureComponent<Props, State> {
<th /> <th />
<th>Name</th> <th>Name</th>
<th>Email</th> <th>Email</th>
<WithFeatureToggle featureToggle={config.editorsCanOwn}> <WithFeatureToggle featureToggle={config.editorsCanAdmin}>
<th>Permission</th> <th>Permission</th>
</WithFeatureToggle> </WithFeatureToggle>
{syncEnabled && <th />} {syncEnabled && <th />}
......
...@@ -207,7 +207,7 @@ export function setupAngularRoutes($routeProvider, $locationProvider) { ...@@ -207,7 +207,7 @@ export function setupAngularRoutes($routeProvider, $locationProvider) {
.when('/org/teams/edit/:id/:page?', { .when('/org/teams/edit/:id/:page?', {
template: '<react-container />', template: '<react-container />',
resolve: { resolve: {
roles: () => (config.editorsCanOwn ? ['Editor', 'Admin'] : ['Admin']), roles: () => (config.editorsCanAdmin ? ['Editor', 'Admin'] : ['Admin']),
component: () => TeamPages, component: () => TeamPages,
}, },
}) })
......
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