File tree Expand file tree Collapse file tree 2 files changed +36
-0
lines changed
Expand file tree Collapse file tree 2 files changed +36
-0
lines changed Original file line number Diff line number Diff line change @@ -36,6 +36,7 @@ Guests users can only access files shared to them and cannot create any files ou
3636 <repair-steps >
3737 <post-migration >
3838 <step >OCA\Guests\Migration\OwncloudGuestsMigration</step >
39+ <step >OCA\Guests\Repair\ResetEmails</step >
3940 </post-migration >
4041 </repair-steps >
4142 <commands >
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ declare (strict_types=1 );
4+ /**
5+ * SPDX-FileCopyrightText: 2025 Robin Appelman <[email protected] > 6+ * SPDX-License-Identifier: AGPL-3.0-or-later
7+ */
8+
9+ namespace OCA \Guests \Repair ;
10+
11+ use OCA \Guests \GuestManager ;
12+ use OCP \IUserManager ;
13+ use OCP \Migration \IOutput ;
14+ use OCP \Migration \IRepairStep ;
15+
16+ class ResetEmails implements IRepairStep {
17+ public function __construct (
18+ private readonly GuestManager $ guestManager ,
19+ private readonly IUserManager $ userManager ,
20+ ) {
21+ }
22+
23+ public function getName (): string {
24+ return "Reset the email of all guest accounts " ;
25+ }
26+
27+ public function run (IOutput $ output ) {
28+ foreach ($ this ->guestManager ->listGuests () as $ guestId ) {
29+ $ guest = $ this ->userManager ->get ($ guestId );
30+ if (strtolower ($ guest ->getSystemEMailAddress ()) !== strtolower ($ guestId )) {
31+ $ guest ->setSystemEMailAddress (strtolower ($ guestId ));
32+ }
33+ }
34+ }
35+ }
You can’t perform that action at this time.
0 commit comments