Proyectos de Subversion Moodle

Rev

Rev 1 | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 1 Rev 11
Línea 627... Línea 627...
627
        }
627
        }
Línea 628... Línea 628...
628
 
628
 
629
        if (!empty($forceremoval)) {
629
        if (!empty($forceremoval)) {
630
            // Remove the users from the power levels if they are not admins.
630
            // Remove the users from the power levels if they are not admins.
-
 
631
            foreach ($forceremoval as $userid) {
631
            foreach ($forceremoval as $userid) {
632
                $muid = matrix_user_manager::get_matrixid_from_moodle($userid);
632
                if ($newuserpowerlevels < matrix_constants::POWER_LEVEL_MAXIMUM) {
633
                if (isset($newuserpowerlevels[$muid]) && $newuserpowerlevels[$muid] < matrix_constants::POWER_LEVEL_MAXIMUM) {
633
                    unset($newuserpowerlevels[$userid]);
634
                    unset($newuserpowerlevels[$muid]);
634
                }
635
                }
635
            }
636
            }
Línea 636... Línea 637...
636
        }
637
        }
637
 
638
 
638
        if (!$this->power_levels_changed($currentuserpowerlevels, $newuserpowerlevels)) {
639
        if (!$this->power_levels_changed($currentuserpowerlevels, $newuserpowerlevels)) {
639
            // No changes to make.
640
            // No changes to make.
Línea 640... Línea -...
640
            return;
-
 
641
        }
641
            return;
642
 
642
        }
643
 
643
 
644
        // Update the power levels for the room.
644
        // Update the power levels for the room.
645
        $this->matrixapi->update_room_power_levels(
645
        $this->matrixapi->update_room_power_levels(
Línea 720... Línea 720...
720
            throw new \moodle_exception(
720
            throw new \moodle_exception(
721
                'Unable to get power levels for room',
721
                'Unable to get power levels for room',
722
            );
722
            );
723
        }
723
        }
Línea 724... Línea 724...
724
 
724
 
725
        $powerdata = $this->get_body($response);
-
 
726
        $powerdata = array_filter(
-
 
727
            $powerdata->rooms->join->{$roomid}->state->events,
-
 
728
            fn($value) => $value->type === 'm.room.power_levels'
-
 
729
        );
-
 
730
        $powerdata = reset($powerdata);
-
 
731
 
-
 
732
        return $powerdata->content;
725
        return $this->get_body($response);
Línea 733... Línea 726...
733
    }
726
    }
734
 
727
 
735
    /**
728
    /**