OverviewΒΆ
What the plugin doesΒΆ
local_suap is a local type plugin for Moodle. It represents the Moodle-side integration between SUAP Edu (IFRNβs academic management system) and Moodle: via its HTTP API, it receives course structures, enrolments, cohorts, and grades from SUAP (typically through the Integrador AVA) and applies them to Moodle, creating or updating:
course categories (hierarchy: Logbooks/DiΓ‘rios β Campus β Course β Term β Class/Turma);
courses/rooms (logbooks/diΓ‘rios, coordination rooms, self-enrolment, practicals, and models);
users (students, teachers, and support staff) and dozens of custom profile fields;
cohorts (global groups) and their members;
enrolments and role assignments, including automatic suspension of students who leave official lists;
groups within each room (by entry year/term, class, campus hub, and program).
In addition to top-down synchronization (SUAP β Moodle), the plugin exposes endpoints for the reverse direction: returning grades from Moodleβs gradebook back to SUAP (sync_down_grades) and synchronizing user preferences between Moodle and the AVA Panel (sync_user_preference/set_user_preference). See API & Services for the complete service list and SUAP β Moodle Synchronization for the step-by-step enrolment synchronization process.
RequirementsΒΆ
$plugin->requires=2021051700inversion.php(Moodle 3.11+).The CI pipeline (
.github/workflows/ci.yml) tests the plugin againstMOODLE_401_STABLE,MOODLE_402_STABLE, andMOODLE_403_STABLEwith PHP8.3on PostgreSQL and MariaDB.
Note
The requirement declared in version.php (Moodle 3.11+) is more permissive than the versions covered in CI (Moodle 4.1 to 4.3). Treat the CI matrix as the verified compatibility guarantee.
Integration with auth_suapΒΆ
local_suap does not depend on any other suite plugin to function, but it is consumed by auth_suap (SUAP OAuth2 authentication plugin): if local_suap is installed, auth_suap reads the default_user_preferences setting (configured in this pluginβs admin settings, see Installation) and applies those preferences upon initial account creation performed by OAuth2 login. local_suap also applies these preferences when creating a user via sync_up_enrolments (see SUAP β Moodle Synchronization). This shared configuration via get_config('local_suap', 'default_user_preferences') is the direct interface between the two plugins.
Repository StructureΒΆ
local_suap/
βββ adminlib.php # Admin settings page definition (admin/settings.php)
βββ locallib.php # Generic helpers: get_or_create, create_or_update, custom fields
βββ login.php # Redirects to OAuth2 login (auth/oauth2)
βββ health.php # Raw diagnostic page (not the health API)
βββ healthcheck.php # Simple endpoint: component/release/version in JSON
βββ settings.php # Registers admin page in Server menu
βββ version.php # Plugin version/release/maturity
βββ admin/
β βββ index.php # Lists received sync requests
β βββ view.php # Details a sync request (JSON payload, status, logs)
β βββ tasklogs.php # Scheduled task logs linked to a request
βββ api/
β βββ index.php # Dispatcher: validates requested service and delegates
β βββ servicelib.php # Base service class: token authentication and response contract
β βββ health.php # "health" service: plugin/Moodle version without side effects
β βββ get_diarios.php # Lists logbooks/coordinations/practicals of a user
β βββ get_atualizacoes_counts.php # Unread messages/notifications count
β βββ set_favourite_course.php # Favorite/unfavorite course
β βββ set_visible_course.php # Change course visibility
β βββ set_user_preference.php # Saves user preference from AVA Panel
β βββ sync_user_preference.php # Forwards Moodle user preference to AVA Panel
β βββ sync_up_enrolments.php # Main service: syncs categories/courses/users/enrolments
β βββ sync_down_grades.php # Fetches grades and completion rates of a logbook for SUAP
βββ classes/
β βββ observer.php # User/enrolment event observers
β βββ Jsv4/ # JSON Schema validation library (draft-04)
β βββ task/
β β βββ generate_report_task.php # Scheduled task: self-instructional course report
β β βββ sync_up_enrolments_task.php # Async adhoc task processing sync in background
β βββ output/
β βββ renderer.php # Plugin renderer
β βββ relatorio_page.php # Self-instructional course report page renderer
βββ cursos/relatorio.php # Self-instructional course report page
βββ db/
β βββ install.php # Creates custom fields and tables on installation
β βββ install.xml # Table definitions
β βββ upgrade.php # Upgrade savepoints and field recreations
β βββ uninstall.php # Uninstallation hook
β βββ access.php # Capabilities: local/suap:adminview, local/suap:view_mooc_reports
β βββ events.php # Registered observers
β βββ tasks.php # Scheduling for generate_report_task
β βββ migrate.php # Shared migration functions
βββ examples/ # Sample JSON payloads accepted by API
βββ schemas/ # Partial JSON schema for sync_up_enrolments payload
βββ templates/ # Mustache templates: sync list/detail and reports
βββ lang/{en,es,fr,nl,pt_br,zh_cn}/local_suap.php # Language strings
βββ requests.http # API HTTP call examples
βββ docs/ # Documentation (Sphinx)
βββ .github/workflows/
βββ ci.yml # moodle-plugin-ci workflow
βββ release.yml # Generates installable ZIP on git tag
βββ docs.yml # Publishes documentation to GitHub Pages
OrganizationΒΆ
The repository lives under the suap-ava-suite organization as moodle-local_suap alongside other AVA/SUAP suite components used by IFRN β such as auth_suap and the AVA Panel.