Skip to content

Commit e083540

Browse files
authored
WithAnonymous: Note for WithAnonymous() for library users that this will not be used (#1432)
* note for library users that this will not be used * add new method to use * add deprecation notice as logs * change readme to point to new WithAnonymoutAuth
1 parent 357eee0 commit e083540

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

grafana/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ local k = import 'k.libsonnet';
4141
prometheus_datasource:: grafana.datasource.new('prometheus', $.config.prometheus_url, type='prometheus', default=true),
4242
4343
grafana: grafana
44-
+ grafana.withAnonymous()
44+
+ grafana.withAnonymousAuth()
4545
+ grafana.addFolder('Example')
4646
+ grafana.addDashboard('simple', (import 'dashboard-simple.libsonnet'), folder='Example')
4747
+ grafana.addDatasource('prometheus', $.prometheus_datasource),

grafana/config.libsonnet

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,10 @@
6363
},
6464
}),
6565

66+
// NOTE: This method will be enforced to only have `org_role` set 'Viewer'
67+
// Deprecated: Deprecated from G12
6668
withAnonymous():: self.withGrafanaIniConfig({
69+
assert std.trace('DEPRECATED: Anonymous users will be enforced to Viewer from Grafana v12. Please use withAnonymousAuth', true),
6770
sections+: {
6871
'auth.anonymous': {
6972
enabled: true,
@@ -72,6 +75,16 @@
7275
},
7376
}),
7477

78+
// NOTE: new method
79+
withAnonymousAuth():: self.withGrafanaIniConfig({
80+
sections+: {
81+
'auth.anonymous': {
82+
enabled: true,
83+
org_role: 'Viewer',
84+
},
85+
},
86+
}),
87+
7588
withEnterpriseLicenseText(text):: self.withGrafanaIniConfig({
7689
sections+: {
7790
enterprise+: {

0 commit comments

Comments
 (0)