MDL-48660 Availability: filter_user_list() should respect 'view hidden'

Updated filter_user_list and get_user_list_sql to account for
the viewhiddenactivities and viewhiddensections capabilities.
This commit is contained in:
sam marshall
2015-01-27 10:59:05 +00:00
parent da0ef2e4cf
commit 6b40e5b2ec
6 changed files with 90 additions and 8 deletions
+11 -2
View File
@@ -139,7 +139,8 @@ abstract class tree_node {
/**
* Tests this condition against a user list. Users who do not meet the
* condition will be removed from the list.
* condition will be removed from the list, unless they have the ability
* to view hidden activities/sections.
*
* This function must be implemented if is_applied_to_user_lists returns
* true. Otherwise it will not be called.
@@ -150,6 +151,10 @@ abstract class tree_node {
* Within this function, if you need to check capabilities, please use
* the provided checker which caches results where possible.
*
* Conditions do not need to check the viewhiddenactivities or
* viewhiddensections capabilities. These are handled by
* core_availability\info::filter_user_list.
*
* @param array $users Array of userid => object
* @param bool $not True if this condition is applying in negative mode
* @param \core_availability\info $info Item we're checking
@@ -167,7 +172,7 @@ abstract class tree_node {
* Obtains SQL that returns a list of enrolled users that has been filtered
* by the conditions applied in the availability API, similar to calling
* get_enrolled_users and then filter_user_list. As for filter_user_list,
* this ONLY filteres out users with conditions that are marked as applying
* this ONLY filters out users with conditions that are marked as applying
* to user lists. For example, group conditions are included but date
* conditions are not included.
*
@@ -180,6 +185,10 @@ abstract class tree_node {
*
* If there are no conditions, the returned result is array('', array()).
*
* Conditions do not need to check the viewhiddenactivities or
* viewhiddensections capabilities. These are handled by
* core_availability\info::get_user_list_sql.
*
* @param bool $not True if this condition is applying in negative mode
* @param \core_availability\info $info Item we're checking
* @param bool $onlyactive If true, only returns active enrolments