feat: Add capability for viewing user grades
Defines a new capability 'report/usergrades:view' with associated risks and context level. Grants managers permission to access this report. Updates page setup to check the new capability, ensuring appropriate access control. Increments plugin version to reflect these changes. Enhances security and manages user access more effectively.
This commit is contained in:
parent
d58349069d
commit
79aa7978bb
3 changed files with 14 additions and 2 deletions
12
db/access.php
Normal file
12
db/access.php
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
$capabilities = array(
|
||||||
|
'report/usergrades:view' => array(
|
||||||
|
'riskbitmask' => RISK_PERSONAL,
|
||||||
|
'captype' => 'read',
|
||||||
|
'contextlevel' => CONTEXT_SYSTEM,
|
||||||
|
'archetypes' => array(
|
||||||
|
'manager' => CAP_ALLOW,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
|
@ -7,7 +7,7 @@ require_once($CFG->libdir . '/formslib.php');
|
||||||
require_once($CFG->dirroot . '/user/selector/lib.php');
|
require_once($CFG->dirroot . '/user/selector/lib.php');
|
||||||
|
|
||||||
// Set up the page context and other configurations
|
// Set up the page context and other configurations
|
||||||
admin_externalpage_setup('report_usergrades');
|
admin_externalpage_setup('report_usergrades', '', null, '', array('capability' => 'report/usergrades:view'));
|
||||||
|
|
||||||
class user_selector extends user_selector_base
|
class user_selector extends user_selector_base
|
||||||
{
|
{
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
defined('MOODLE_INTERNAL') || die();
|
defined('MOODLE_INTERNAL') || die();
|
||||||
|
|
||||||
$plugin->component = 'report_usergrades';
|
$plugin->component = 'report_usergrades';
|
||||||
$plugin->version = 2024112000;
|
$plugin->version = 2024112001;
|
||||||
$plugin->requires = 2022041900;
|
$plugin->requires = 2022041900;
|
||||||
$plugin->maturity = MATURITY_ALPHA;
|
$plugin->maturity = MATURITY_ALPHA;
|
||||||
$plugin->release = 'v1.0';
|
$plugin->release = 'v1.0';
|
||||||
|
|
Loading…
Reference in a new issue