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