Aquesta pàgina forma part de la documentació de Moodle en català, tot i que no ha estat traduïda encara. Podeu contribuir obertament a les tasques de traducció. Podeu consultar la Guia d'edició de la documentació i també participar ens els debats del fòrum de traductors de la documentació a moodle.org

NEWMODULE Adding capabilities: diferència entre les revisions

De MoodleDocs
Salta a:navegació, cerca
Cap resum de modificació
 
Cap resum de modificació
Línia 7: Línia 7:
$mod_glossary_capabilities = array(
$mod_glossary_capabilities = array(


    'mod/<<NEWMODULE>>:<<CAPABILITYNAME>>' => array(
'mod/<<NEWMODULE>>:<<CAPABILITYNAME>>' => array(


        'riskbitmask' => RISK_SPAM | RISK_PERSONAL | RISK_XSS | RISK_CONFIG,
'riskbitmask' => RISK_SPAM | RISK_PERSONAL | RISK_XSS | RISK_CONFIG,


        'captype' => 'write',
'captype' => 'write',
        'contextlevel' => CONTEXT_MODULE,
'contextlevel' => CONTEXT_MODULE,
        'legacy' => array(
'legacy' => array(
            'student' => CAP_ALLOW,
    'student' => CAP_ALLOW,
            'teacher' => CAP_ALLOW,
    'teacher' => CAP_ALLOW,
            'editingteacher' => CAP_ALLOW,
    'editingteacher' => CAP_ALLOW,
            'admin' => CAP_ALLOW
    'admin' => CAP_ALLOW
         )
         )
     ),
     ),

Revisió del 14:20, 7 abr 2008

Create one access.php file in the <<NEWMODULE>>/db directory. It must contain

  • the capabilities to be installed and
  • the defaults for each standard role.

A model of what has to be added is: $mod_glossary_capabilities = array(

'mod/<<NEWMODULE>>:<<CAPABILITYNAME>>' => array(

'riskbitmask' => RISK_SPAM | RISK_PERSONAL | RISK_XSS | RISK_CONFIG,

'captype' => 'write', 'contextlevel' => CONTEXT_MODULE, 'legacy' => array(

   'student' => CAP_ALLOW,
   'teacher' => CAP_ALLOW,
   'editingteacher' => CAP_ALLOW,
   'admin' => CAP_ALLOW
       )
   ),

iterate the array 'mod/<<NEWMODULE>>:<<PERMISSIONNAME>>' for each <<CAPABILITYNAME>> you want to add following the same structure and, at the end, close the array )

The element 'riskbitmask' will be reflected in the list of icons of each row of the 'Override permissions'->roles page. You should add the right number of icon ranging from

  • all four icons
       'riskbitmask' => RISK_SPAM | RISK_PERSONAL | RISK_XSS | RISK_CONFIG,
  • up to no icon at all, just removing the element 'riskbitmask' from the array 'mod/<<NEWMODULE>>:<<CAPABILITYNAME>>'

The element 'captype' is ??? The element 'contextlevel' is ??? The element 'legacy' define the legacy default for that permission. It is an array and for each each element you are allowed to choose one (and only one) of this four elements: CAP_ALLOW, CAP_PREVENT, CAP_PROHIBIT, and inherit (if you don't set it). This define the default radio button selected in the 'Legacy roles' page.