Repository navigation
RivetIT 26.10.45: one Run script dialog, one Scripts area
·
747 commits
to production
since this release
No database step. Fixes the asset page's Run script dialog, which listed only "PowerShell text" (the RivetCore script library was reachable only from a separate card on the Jobs tab, and Linux devices had no Run script at all), and merges the two script menus.
- One dialog for everything. What to run lists, in this order: Script library (N) (only when the scripts switch is on, the viewer may run saved scripts and the library has scripts for this device's platform), A saved script (the older
rmm_scriptslist, Windows, only if any, grouped "Saved here" and "Synced from "), and PowerShell (type or paste) on Windows or Shell (type or paste) on Linux (Core job typespowershellandshell, abilityrmm.job.run_script; the option is hidden for a viewer without it). A single choice is shown as text, never as a one-option dropdown. The old wording "PowerShell text" is gone. - Library pane. A search box filters the list live (name, description, tags; the count is announced), the list is grouped Read only / Changes the system / Disruptive / your own scripts, and the chosen script shows its risk badge, tags, description and a typed parameter form (numbers with min/max, bounded text, choices, secrets as password fields, required marks and hints). A script's
dry_runparameter is the checkbox Dry run (nothing is changed), ticked by default; it always posts an explicit true or false. A script that needs approval says the request goes to the approvals queue (and does); a destructive script has a required confirm box. The form posts to the same handler as the Jobs-tab card (agent/post/rmm_automation_scr.php, actionrun_script): CSRF, client scoping and Core's ability checks are unchanged, the person lands on the Jobs tab with "Job queued". Empty library: the dialog says so and links the Starter pack (administrators) and Scripts. - Linux devices have the Run script button and the dialog (Linux library scripts, free-form shell text).
- One Scripts entry. The menu had Script library and Scripts. Now there is one Scripts entry (active on both pages). Its page has a Library tab (the RivetCore library, starter pack included) and a Synced from tab (the older list; the tab exists only when that list has rows or a vendor RMM integration is configured).
rmm_scripts.phpwith nothing of its own to show redirects to the Library tab (query kept);rmm_script_library.php,rmm_script_run.phpand every deep link keep working. With the scripts switch off the menu keeps the single older entry. The older list is also usable on a phone now (table scrolls inside its card). - Import into the library. Administrators with the script-write level get a one-time card on the older list: the scripts written by hand (no vendor script id) become signed library scripts through the technician API (language from the stored type, tags from the category plus
risk:<class>, class chosen by the administrator, default changes_system; a disruptive class sets approval and destructive like the starter pack; note "imported from legacy Scripts"). Idempotent (same name and text is skipped), audited, CMD scripts are reported, the older rows stay and say Imported. - Tests. New
tests/rmm_ui_p23_d_runscript.php(dialog markup for Windows, Linux, restricted roles, empty states; real runs through the handler with the job decoded for library_script_id, version and params; dry run on and off; approvals; destructive confirm; CSRF, viewer and department refusals; switch and module off with zero queries; menu, tabs, old URLs, import idempotence) andtests/browser/rmm_runscript_smoke.mjs(13 checks in Chrome, desktop and 390 px, light and dark).tests/rmm_ui.phpandrmm_smoke.mjsupdated for Linux's enabled button. - Not verified: nothing was deployed; browser run is Chrome only.