mirror of
https://github.com/mailcow/mailcow-dockerized.git
synced 2026-11-05 07:58:20 +00:00
[Web] imapsync: change the server of a sync source only with access to all its sync jobs
This commit is contained in:
5 files changed
+45
-1
No files matched your search
@@ -292,6 +292,20 @@ class SourceServiceTest extends TestCase
|
||||
$this->expectUserError('access_denied', fn() => $service->update(7, ['name' => 'b']));
|
||||
}
|
||||
|
||||
public function testServerOnlyChangesWhenAllJobsAreAccessible(): void
|
||||
{
|
||||
$this->repo->method('findVisible')->willReturn(self::source(['created_by' => 'u@example.org']));
|
||||
$this->repo->expects($this->exactly(2))->method('jobMailboxes')
|
||||
->willReturnOnConsecutiveCalls(['u@example.org', 'other@example.org'], ['u@example.org']);
|
||||
$this->repo->expects($this->exactly(2))->method('update');
|
||||
$service = $this->service(FakeContext::user('u@example.org'));
|
||||
|
||||
$this->expectUserError(['imapsync_source_used_by_others', 'src'], fn() => $service->update(7, ['host' => 'other.example.org']));
|
||||
$service->update(7, ['host' => 'new.example.org']);
|
||||
// Name or description changes keep the server and need no check
|
||||
$service->update(7, ['description' => 'x']);
|
||||
}
|
||||
|
||||
public function testUsersMayNotSwitchToXOAuth2(): void
|
||||
{
|
||||
$this->repo->method('findVisible')->willReturn(self::source(['created_by' => 'u@example.org']));
|
||||
|
||||
Reference in new issue
Block a user