feat(19.6.1-01): Administrators screen and cross-controller record actions
- pact.HasAdminActionExtensions / AdminActionExtension: plugins add record actions to any admin controller by ID, merged at boot before permission validation (unknown target, no preview, duplicate name stop the boot) - internal summercms.cabana pseudo-plugin, appended only when some plugin registers admin controllers: Administrators list and preview, settings link under System, backend.manage_users and backend.manage_roles with no role grants - backend::lang user, user.role and permissions copy (en, pl) - smoke tests: compile-time seam and settings, Postgres list/preview/action
This commit is contained in:
@@ -375,6 +375,38 @@ type HasAdminRecordActions interface {
|
||||
AdminRecordActions() []AdminRecordAction
|
||||
}
|
||||
|
||||
// AdminActionExtension adds actions to an admin controller that another
|
||||
// plugin owns, or that the plugin itself owns. Controller is the controller
|
||||
// ID (vendor.plugin.controller) of any activated plugin's admin controller,
|
||||
// the admin framework's own controllers included.
|
||||
//
|
||||
// RecordActions are offered on the target controller's preview screen after
|
||||
// the owner's record actions, in plugin activation order. Each one keeps its
|
||||
// own Permissions, Applies, Confirm and Danger and runs exactly like the
|
||||
// owner's record actions: the framework loads and row-locks the record
|
||||
// through the target's FormExtendQuery scope inside the action's transaction
|
||||
// and hands it to Run, which reads that transaction with
|
||||
// cabana.TxFromContext. An administrator needs the target controller's
|
||||
// RequiredPermissions and the action's own Permissions. A record action
|
||||
// carries no input beyond the record.
|
||||
//
|
||||
// The admin compiles extensions at boot, only when it is active (some
|
||||
// plugin registers admin controllers). An unknown controller ID, a target
|
||||
// without a preview block, a name the owner or an earlier extension already
|
||||
// registers on that controller, a reserved name (create, delete), a name that
|
||||
// is not an identifier, a missing Run or an empty Label stops the boot. Only
|
||||
// record actions are carried for now; the struct leaves room for more kinds.
|
||||
type AdminActionExtension struct {
|
||||
Controller string
|
||||
RecordActions []AdminRecordAction
|
||||
}
|
||||
|
||||
// HasAdminActionExtensions is implemented by plugins (not admin controllers)
|
||||
// that add actions to admin controllers by controller ID.
|
||||
type HasAdminActionExtensions interface {
|
||||
AdminActionExtensions() []AdminActionExtension
|
||||
}
|
||||
|
||||
// AdminPartialData supplies the view model a controller partial template
|
||||
// renders (config_list.yaml headerPartial, fields.yaml `type: partial`). name
|
||||
// is the partial name; record is the scoped record for a form partial on an
|
||||
|
||||
Reference in New Issue
Block a user