'mod/your_module:view' => array(
'captype' => 'read',
'contextlevel' => CONTEXT_MODULE,
'legacy' => array(
'teacher' => CAP_ALLOW
)
)
'captype' => 'read',
'contextlevel' => CONTEXT_MODULE,
'legacy' => array(
'teacher' => CAP_ALLOW
)
)
Open \mod\your_module\lang\en\your_module.php, add this line:
$string['your_module:view'] = 'View your module';
Change version.php to new version, and then goto Notification.
Use this to test the permission:
$context = get_context_instance(CONTEXT_MODULE, $cm->id);
has_capability('mod/your_module:view', $context)
has_capability('mod/your_module:view', $context)
沒有留言:
張貼留言