mirror of
https://github.com/grafana/grafana.git
synced 2025-08-02 04:31:36 +08:00
Storage: allow public access to public files (#52849)
This commit is contained in:
@ -143,6 +143,15 @@ func ProvideService(sql *sqlstore.SQLStore, features featuremgmt.FeatureToggles,
|
|||||||
}
|
}
|
||||||
|
|
||||||
authService := newStaticStorageAuthService(func(ctx context.Context, user *models.SignedInUser, storageName string) map[string]filestorage.PathFilter {
|
authService := newStaticStorageAuthService(func(ctx context.Context, user *models.SignedInUser, storageName string) map[string]filestorage.PathFilter {
|
||||||
|
// Public is OK to read regardless of user settings
|
||||||
|
if storageName == RootPublicStatic {
|
||||||
|
return map[string]filestorage.PathFilter{
|
||||||
|
ActionFilesRead: allowAllPathFilter,
|
||||||
|
ActionFilesWrite: denyAllPathFilter,
|
||||||
|
ActionFilesDelete: denyAllPathFilter,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if user == nil {
|
if user == nil {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
@ -171,12 +180,6 @@ func ProvideService(sql *sqlstore.SQLStore, features featuremgmt.FeatureToggles,
|
|||||||
}
|
}
|
||||||
|
|
||||||
switch storageName {
|
switch storageName {
|
||||||
case RootPublicStatic:
|
|
||||||
return map[string]filestorage.PathFilter{
|
|
||||||
ActionFilesRead: allowAllPathFilter,
|
|
||||||
ActionFilesWrite: denyAllPathFilter,
|
|
||||||
ActionFilesDelete: denyAllPathFilter,
|
|
||||||
}
|
|
||||||
case RootDevenv:
|
case RootDevenv:
|
||||||
return map[string]filestorage.PathFilter{
|
return map[string]filestorage.PathFilter{
|
||||||
ActionFilesRead: allowAllPathFilter,
|
ActionFilesRead: allowAllPathFilter,
|
||||||
|
Reference in New Issue
Block a user