MDL-79174 availability: Allow group condition to use hidden groups
Previously, groups with GROUP_VISIBILITY_NONE could be selected for an availability condition, but as the group API did not return a user's own groups with this visibility, the condition's is_available check always failed. This change uses the new $includehidden parameter to get all of a user's groups from groups_get_user_groups when evaluating the condition, so these groups work as expected. Due to the enforced hiding of conditions containing these groups, they will never be seen by the user.
This commit is contained in:
@@ -71,7 +71,7 @@ class condition extends \core_availability\condition {
|
||||
$allow = true;
|
||||
if (!has_capability('moodle/site:accessallgroups', $context, $userid)) {
|
||||
// Get all groups the user belongs to.
|
||||
$groups = $info->get_modinfo()->get_groups();
|
||||
$groups = $info->get_groups();
|
||||
if ($this->groupid) {
|
||||
$allow = in_array($this->groupid, $groups);
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user