Fix issue with permissions in host activity list for fleet-users (#46362)
**Related issue:** Resolves #46009. - [X] Changes file added for user-visible changes in `changes/`, `orbit/changes/` or `ee/fleetd-chrome/changes`. ## Testing - [X] Added/updated automated tests - [X] QA'd all new/changed functionality manually <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Bug Fixes** * Resolved an authorization issue preventing users from viewing past host activities on hosts that contained user-initiated operations such as lock, wipe, run script, or install software. <!-- review_stack_entry_start --> [](https://app.coderabbit.ai/change-stack/fleetdm/fleet/pull/46362?utm_source=github_walkthrough&utm_medium=github&utm_campaign=change_stack) <!-- review_stack_entry_end --> <!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
+3
-3
@@ -1084,7 +1084,7 @@ func runServeCmd(cmd *cobra.Command, configManager configpkg.Manager, debug, dev
|
||||
logger.InfoContext(ctx, "instance info", "instanceID", instanceID)
|
||||
|
||||
// Bootstrap activity bounded context (needed for cron schedules and HTTP routes)
|
||||
activitySvc, activityRoutes := createActivityBoundedContext(svc, dbConns, logger)
|
||||
activitySvc, activityRoutes := createActivityBoundedContext(svc, ds, dbConns, logger)
|
||||
// Inject the activity bounded context into the main service
|
||||
svc.SetActivityService(activitySvc)
|
||||
|
||||
@@ -1978,13 +1978,13 @@ func initOrgLogoStore(ctx context.Context, s3Config configpkg.S3Config, logger *
|
||||
return store
|
||||
}
|
||||
|
||||
func createActivityBoundedContext(svc fleet.Service, dbConns *common_mysql.DBConnections, logger *slog.Logger) (activity_api.Service, endpointer.HandlerRoutesFunc) {
|
||||
func createActivityBoundedContext(svc fleet.Service, ds fleet.Datastore, dbConns *common_mysql.DBConnections, logger *slog.Logger) (activity_api.Service, endpointer.HandlerRoutesFunc) {
|
||||
legacyAuthorizer, err := authz.NewAuthorizer()
|
||||
if err != nil {
|
||||
initFatal(err, "initializing activity authorizer")
|
||||
}
|
||||
activityAuthorizer := authz.NewAuthorizerAdapter(legacyAuthorizer)
|
||||
activityACLAdapter := activityacl.NewFleetServiceAdapter(svc)
|
||||
activityACLAdapter := activityacl.NewFleetServiceAdapter(svc, ds)
|
||||
activitySvc, activityRoutesFn := activity_bootstrap.New(
|
||||
dbConns,
|
||||
activityAuthorizer,
|
||||
|
||||
Reference in New Issue
Block a user