]> git.mjollnir.org Git - moodle.git/commit
block contexts: MDL-19098 every block should have a context
authortjhunt <tjhunt>
Mon, 13 Jul 2009 08:37:34 +0000 (08:37 +0000)
committertjhunt <tjhunt>
Mon, 13 Jul 2009 08:37:34 +0000 (08:37 +0000)
commite92c286c20345f513f72bc7b12e3f86fc079d4d2
treeae7a53471a9ce594cb059fc3cd103adeee898e3e
parentdc203659af1c4a8c335dc6327547917f8606b76e
block contexts: MDL-19098 every block should have a context
even non-course and sticky blocks.

The parent context is block_instances.parentcontextid.

The block context should be used for checking permissions directly
related to the block, like moodle/block:view or moodle/site:manageblocks.

However, if the block is displaying information about the current page,
for example the participants block showing who 'here', then it may be
better to use the context of the page where the bloack is appearing -
in other words $this->page->context - to check permissions about the
user's ability to see participants here.

Or, if the block is displaying something stronly related to courses,
for example, a course meny block, the block should probably use the
context for $this->page->course to check permissions.
19 files changed:
admin/replace.php
admin/roles/assign.php
admin/roles/check.php
admin/roles/lib.php
admin/roles/override.php
admin/roles/tabs.php
blocks/admin/block_admin.php
blocks/html/block_html.php
blocks/mentees/block_mentees.php
blocks/moodleblock.class.php
blocks/online_users/block_online_users.php
blocks/quiz_results/block_quiz_results.php
blocks/rss_client/block_rss_client.php
blocks/rss_client/config_instance.html
blocks/rss_client/config_instance_tabs.php
lib/accesslib.php
lib/blocklib.php
lib/db/upgrade.php
version.php