Skip to content

jport500/moodle-local_lmslight_admin

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

LMS Light Admin Hub

A Moodle local plugin that provides a task-based admin dashboard for LMS Light sites, replacing the native Site Administration tree as the primary entry point for Org Admins.

Plugin type: Local Component: local_lmslight_admin Requires: Moodle 5.1+ PHP: 8.1+ Databases: PostgreSQL, MariaDB, MySQL License: GPL v3+

What it does

The Admin Hub organises site administration into domain cards — logical groupings of admin pages that map to how nonprofit, association, and trade group administrators actually think about their LMS.

Each card contains deep-links to the relevant Moodle and MuTMS admin pages. Cards are filtered by user role and subscription level so Org Admins only see what they can access.

Default domains

# Domain Description
1 Organization setup Branding, identity, tenants
2 People & structure Users, teams, roles, authentication
3 Catalog & content Courses, programs, content bank
4 Credentials & compliance Certifications, training credits, badges
5 Enrollment & access Enrolment methods, cohort sync, self-enrol
6 Reports & insights Completion, program, certification, and activity reports
7 System & security Notifications, privacy, plugins, platform config

Requirements

  • local_lmslight must be installed. The hub delegates all access control decisions (platform user detection, subscription level, admin tree pruning) to shared helper functions in local_lmslight/lib.php.

Installation

  1. Copy or clone this plugin into local/lmslight_admin within your Moodle installation.
  2. Log in as a site administrator and visit Site Administration > Notifications to run the database upgrade.
  3. Assign the local/lmslight_admin:view capability to roles that should see the hub (the manager archetype has it by default).
  4. Assign local/lmslight_admin:manage to roles that should manage the hub layout (Platform staff only — enforced by email domain check).

Capabilities

Capability Purpose Default
local/lmslight_admin:view View the hub dashboard Manager archetype
local/lmslight_admin:viewplatform View platform-only cards None
local/lmslight_admin:manage Manage hub layout (CRUD) None

The manage capability additionally requires the user to be an @lmslight.io platform staff member (enforced by local_lmslight_is_platform_user()).

Access control

The hub filters cards and items based on three factors, all provided by local_lmslight:

  1. Platform vs Org Admin — determined by @lmslight.io email domain. Platform staff see all items. Org Admins do not see scope: Platform items.
  2. Admin tree pruning — items whose pruned_key matches a key in local_lmslight_get_pruned_keys() are hidden from Org Admins.
  3. Subscription levellocal_lmslight_get_subscription_level() determines which pruned keys are active (e.g., SSO auth pages are pruned at level < 1).

Navbar icon

A 9-dot grid icon is injected into the primary navigation bar (after the "Site administration" link) for all users with the view capability. It links directly to the hub dashboard.

Managing the hub layout

Platform staff with the manage capability see a Manage layout button on the hub dashboard. The manage page supports:

  • Reorder domain cards and items within cards (drag and drop)
  • Rename domain titles and item labels (inline editing)
  • Edit paths — change the URL an item links to
  • Hide/show individual items (eye toggle)
  • Add new domains and items
  • Delete domains and items

Changes are saved via AJAX and take effect immediately.

Export / Import

The manage page includes Export and Import buttons for maintaining the hub layout across environments:

  • Export downloads the current layout as a JSON file. This file is compatible with the seed format (docs/nav_inventory.json) and can be committed to the plugin repository as the default layout for new installs.
  • Import uploads a JSON file and replaces all existing domains and items. Useful for loading a layout configured on a pristine reference site.

Workflow for updating the seed file:

  1. Configure the hub on a clean reference site using the manage page.
  2. Click Export to download the JSON.
  3. Replace docs/nav_inventory.json with the exported file.
  4. Commit and deploy — new installs will use the updated layout.

Existing installs are not affected by seed file changes. Use Import to update a running site.

Database tables

Table Purpose
local_llad_domains Domain cards — key, label, description, icon, sort order
local_llad_items Items within domains — label, path, scope, plugin, pruned_key, sort order, hidden

On fresh install, both tables are seeded from docs/nav_inventory.json.

File structure

local/lmslight_admin/
├── index.php                  # Hub dashboard
├── manage.php                 # Layout management (Platform only)
├── export.php                 # Export layout as JSON
├── import.php                 # Import layout from JSON
├── version.php
├── styles.css
├── classes/
│   ├── external/              # AJAX web service endpoints
│   │   ├── save_layout.php    # Bulk save (labels, order, paths, hidden)
│   │   ├── add_domain.php
│   │   ├── delete_domain.php
│   │   ├── add_item.php
│   │   └── delete_item.php
│   ├── form/
│   │   └── import_form.php    # Moodle form for JSON file upload
│   ├── hook/output/
│   │   └── before_standard_head_html_generation.php  # Navbar icon
│   ├── navigation/
│   │   ├── inventory.php      # Loads and filters domains/items from DB
│   │   └── seeder.php         # Seeds DB from nav_inventory.json
│   └── output/
│       ├── hub_page.php       # Hub dashboard renderable
│       ├── domain_card.php    # Domain card renderable
│       └── manage_page.php    # Manage page renderable
├── db/
│   ├── access.php             # Capability definitions
│   ├── hooks.php              # Hook callback registrations
│   ├── install.xml            # Table schemas
│   ├── services.php           # External service definitions
│   └── upgrade.php            # Database migration steps
├── lang/en/
│   └── local_lmslight_admin.php
├── templates/
│   ├── hub_page.mustache
│   ├── domain_card.mustache
│   └── manage_page.mustache
├── amd/
│   ├── src/
│   │   ├── manage.js          # Drag-and-drop, CRUD, save logic
│   │   └── nav_icon.js        # Navbar icon injection
│   └── build/
│       ├── manage.min.js
│       └── nav_icon.min.js
└── docs/
    └── nav_inventory.json     # Seed data for fresh installs

Dependencies on MuTMS plugins

Several hub items link to MuTMS plugin admin pages. These items are included in the default seed data but will only function when the corresponding plugin is installed:

  • tool_mutenancy — Tenant management
  • tool_muprog / enrol_muprog — Programs
  • tool_mucertify — Certifications
  • tool_mutrain — Training credits
  • tool_murelation — Supervisors & teams
  • tool_musudo — Privileged sessions
  • tool_muhome — Custom home pages
  • tool_mupwned — Compromised password checks

Items linking to uninstalled plugins will display but return 404s. Remove or hide them via the manage page if the plugin is not deployed.

Development

Building AMD modules

From the Moodle root directory:

npx grunt amd --root=local/lmslight_admin

Coding standards

  • Moodle coding style: https://moodledev.io/general/development/policies/codingstyle
  • All markup in Mustache templates — no HTML in PHP
  • All JS in AMD modules — no inline <script> blocks
  • All strings in lang/en/local_lmslight_admin.php
  • Valid Moodle risk constants: RISK_SPAM, RISK_PERSONAL, RISK_XSS, RISK_CONFIG, RISK_DATALOSS, RISK_MANAGETRUST (never prefix with CAP_)

License

This plugin is licensed under the GNU General Public License v3 or later. See LICENSE for details.

Copyright 2026 LMS Light

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors