Block capabilities

Block capabilities

by Helson C -
Number of replies: 3

Hello everyone,

I don't understand why the below code, dont't prevent an user (stundet, or logged user) of add myblock in my page.

My intent is to prohibit by default.


$capabilities = array(

    'block/secretariavirtual:myaddinstance' => array(

        'captype' => 'write',

        'contextlevel' => CONTEXT_SYSTEM,

        'archetypes' => array(

        'editingteacher' => CAP_PROHIBIT,

            'student' => CAP_PROHIBIT,

            'user' => CAP_PROHIBIT

        ),

        'clonepermissionsfrom' => 'moodle/my:manageblocks'

    ),

);


Average of ratings: -
In reply to Helson C

Re: Block capabilities

by Julen Pardo -

Hi,

Set the context to CONTEXT_COURSE.

And, also, try removing the "clonepermissionsfrom" element, since the users have permission to edit the blocks in 'My' course.


Cheers,

Julen

In reply to Julen Pardo

Re: Block capabilities

by Helson C -

Julen, do you know the diference in this case betwen 'contextlevel' => CONTEXT_SYSTEM  and 'contextlevel' => COURSE_SYSTEM?


Thanks.