Skip to content

Commit

Permalink
fix: require perms to use intergrations widget (#740)
Browse files Browse the repository at this point in the history
  • Loading branch information
CodyWMitchell authored Nov 27, 2024
1 parent c381cea commit 4c957e3
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
7 changes: 4 additions & 3 deletions rest/models/DashboardTemplate.go
Original file line number Diff line number Diff line change
Expand Up @@ -331,9 +331,10 @@ type WidgetHeaderLink struct {
type WidgetPermissionMethods string

const (
OrgAdmin WidgetPermissionMethods = "isOrgAdmin"
FeatureFlag WidgetPermissionMethods = "featureFlag"
HasPermissions WidgetPermissionMethods = "hasPermissions"
OrgAdmin WidgetPermissionMethods = "isOrgAdmin"
FeatureFlag WidgetPermissionMethods = "featureFlag"
HasPermissions WidgetPermissionMethods = "hasPermissions"
LoosePermissions WidgetPermissionMethods = "loosePermissions"
)

type WidgetPermission struct {
Expand Down
6 changes: 6 additions & 0 deletions rest/service/dashboardTemplate.go
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,12 @@ var (
true,
},
},
models.WidgetPermission{
Method: models.LoosePermissions,
Args: []any{
[]string{"sources:*:read", "integrations:endpoints:read"},
},
},
},
},
},
Expand Down

0 comments on commit 4c957e3

Please sign in to comment.