LMSouq
moodle-core Open

Local Plugin permission issue not apply on course manager specifically - Moodle

QU
Query Master
1 month ago
3 views
Problem Description
I am new in Moodle and i have a task to create local plugin with course manager role. In my system i have bulk of users in specific course and they are categories in different roles. Some of are bind with students and rest of are Managers. For my case i have received request from the client to make a local plugin which generate multiple reports against student records. I have successfully made the plugin but the condition is this plugin only can access those one who has enrolled in course as a Manager. I m trying with following code which i share you in below but no success. right now only admin can access local plugin rest of are received error messages from the moodle state. `["Sorry, but you do not currently have permissions to do that Project view "]` No idea how it will be resolved. Please advise. local/project/db/access.php defined('MOODLE_INTERNAL') || die(); $capabilities = array( 'local/project:view' => array( 'riskbitmask' => RISK_PERSONAL, 'captype' => 'read', 'contextlevel' => CONTEXT_SYSTEM, 'archetypes' => array( 'manager' => CAP_ALLOW ), 'local/project:manage' => array( 'captype' => 'write', 'contextlevel' => CONTEXT_SYSTEM, 'archetypes' => array( 'manager' => CAP_ALLOW ) ) ) ); local/project/header.php require(dirname(__FILE__).'/../../config.php'); global $DB; //Get the system context $url = new moodle_url('/local/project/index.php'); require_login(); require_capability('local/project:view', context_system::instance());

AI-Generated Solution

Powered by LMSouq AI · GPT-4.1-mini

✓ Solution Ready
Analyzing problem and generating solution…
Was this solution helpful?
Back to Knowledge Base