mirror of https://github.com/grafana/grafana
commit
83df3bdec8
@ -0,0 +1,79 @@ |
||||
--- |
||||
draft: true |
||||
aliases: |
||||
- ../administration/reports/ |
||||
- ../enterprise/export-pdf/ |
||||
- ../enterprise/reporting/ |
||||
- ../panels/create-reports/ |
||||
- reporting/ |
||||
keywords: |
||||
- grafana |
||||
- announcement |
||||
labels: |
||||
products: |
||||
- cloud |
||||
- enterprise |
||||
menuTitle: Announcement banner |
||||
title: Create and configure announcement banner |
||||
description: Creat a banner to show important updates and information at the top of on every page |
||||
refs: |
||||
rbac: |
||||
- pattern: /docs/grafana/ |
||||
destination: /docs/grafana/<GRAFANA_VERSION>/administration/roles-and-permissions/access-control/ |
||||
- pattern: /docs/grafana-cloud/ |
||||
destination: /docs/grafana/<GRAFANA_VERSION>/administration/roles-and-permissions/access-control/ |
||||
--- |
||||
|
||||
# Create and configure announcement banner |
||||
|
||||
Announcement banner allows you to show important updates and information at the top of every page in Grafana. You can use the announcement banner to communicate important information to your users, such as maintenance windows, new features, or other important updates. |
||||
|
||||
## Create or update an announcement banner |
||||
|
||||
Only organization administrators can create announcement banner by default. You can customize who can create announcement banner with [Role-based access control](ref:rbac). |
||||
|
||||
To create or update an announcement banner, follow these steps: |
||||
|
||||
1. Click **Administration > General > Announcement banner** in the side navigation menu. |
||||
|
||||
The Announcement banner page allows you to view, create and update the settings for a notification banner. Only one banner can be created at a time. |
||||
|
||||
2. Toggle the **Enable** switch on to enable the announcement banner. It can be toggled off at any time to disable the banner. |
||||
|
||||
3. Enter the **Message** for the announcement banner. |
||||
|
||||
The message field supports Markdown. To add a header, use the following syntax: |
||||
|
||||
```markdown |
||||
### Header |
||||
``` |
||||
|
||||
To add a link, use the following syntax: |
||||
|
||||
```markdown |
||||
[link text](https://www.example.com) |
||||
``` |
||||
|
||||
The preview of the configured banner will appear on top of the form, under the **Preview** section. |
||||
|
||||
4. Select the banner's start date and time in the **Starts** field. |
||||
|
||||
By default, the banner starts being displayed immediately. You can set a future date and time for the banner to start displaying. |
||||
|
||||
5. Select the banner's end date and time in the **Ends** field. |
||||
|
||||
By default, the banner is displayed indefinitely. You can set a future date and time for the banner to stop displaying. |
||||
|
||||
6. Select the banner's visibility. |
||||
|
||||
**Everyone** - The banner is visible to all users, including on login page. |
||||
|
||||
**Authenticated users** - The banner is visible to only authenticated users. |
||||
|
||||
7. Select the type of banner in the **Variant** field. |
||||
|
||||
This will determine the color of the banner's background. |
||||
|
||||
8. Click **Save** to save the banner settings. |
||||
|
||||
The banner will now be displayed at the top of every page in Grafana. |
@ -0,0 +1,67 @@ |
||||
package filters |
||||
|
||||
import ( |
||||
"net/http" |
||||
"slices" |
||||
|
||||
"k8s.io/apiserver/pkg/authentication/user" |
||||
"k8s.io/apiserver/pkg/endpoints/request" |
||||
"k8s.io/klog" |
||||
|
||||
"github.com/grafana/grafana/pkg/apimachinery/identity" |
||||
) |
||||
|
||||
// WithRequester makes sure there is an identity.Requester in context
|
||||
func WithRequester(handler http.Handler) http.Handler { |
||||
return http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) { |
||||
ctx := req.Context() |
||||
requester, err := identity.GetRequester(ctx) |
||||
if err != nil { |
||||
// Find the kubernetes user info
|
||||
info, ok := request.UserFrom(ctx) |
||||
if ok { |
||||
if info.GetName() == user.Anonymous { |
||||
requester = &identity.StaticRequester{ |
||||
Namespace: identity.NamespaceAnonymous, |
||||
Name: info.GetName(), |
||||
Login: info.GetName(), |
||||
Permissions: map[int64]map[string][]string{}, |
||||
} |
||||
} |
||||
|
||||
if info.GetName() == user.APIServerUser || |
||||
slices.Contains(info.GetGroups(), user.SystemPrivilegedGroup) { |
||||
orgId := int64(1) |
||||
requester = &identity.StaticRequester{ |
||||
UserID: 1, |
||||
OrgID: orgId, |
||||
Name: info.GetName(), |
||||
Login: info.GetName(), |
||||
OrgRole: identity.RoleAdmin, |
||||
IsGrafanaAdmin: true, |
||||
Permissions: map[int64]map[string][]string{ |
||||
orgId: { |
||||
"*": {"*"}, // all resources, all scopes
|
||||
|
||||
// Dashboards do not support wildcard action
|
||||
// dashboards.ActionDashboardsRead: {"*"},
|
||||
// dashboards.ActionDashboardsCreate: {"*"},
|
||||
// dashboards.ActionDashboardsWrite: {"*"},
|
||||
// dashboards.ActionDashboardsDelete: {"*"},
|
||||
// dashboards.ActionFoldersCreate: {"*"},
|
||||
// dashboards.ActionFoldersRead: {dashboards.ScopeFoldersAll}, // access to read all folders
|
||||
}, |
||||
}, |
||||
} |
||||
} |
||||
|
||||
if requester != nil { |
||||
req = req.WithContext(identity.WithRequester(ctx, requester)) |
||||
} else { |
||||
klog.V(5).Info("unable to map the k8s user to grafana requester", "user", info) |
||||
} |
||||
} |
||||
} |
||||
handler.ServeHTTP(w, req) |
||||
}) |
||||
} |
Loading…
Reference in new issue