wip(Resiliation script)

This commit is contained in:
2026-01-11 18:13:18 +01:00
parent fb6c62f19c
commit 80d96b7004
7 changed files with 148 additions and 4 deletions

View File

@@ -1,6 +1,6 @@
<?php
namespace App\Services;
namespace App\Services\Dolibarr;
use Illuminate\Http\Client\ConnectionException;
use Illuminate\Http\Client\PendingRequest;
@@ -58,4 +58,15 @@ class DolibarrService
return $response->json();
}
public function setMemberStatus(int|string $id, string $status): bool
{
$response = $this->client()->put(
$this->baseUrl . '/members/' . $id,
['status' => $status]
);
return $response->successful();
}
}

View File

@@ -87,4 +87,20 @@ class ISPConfigMailService extends ISPConfigService
'spam_filter' => $user['move_junk'] === 'y',
];
}
public function updateMailUser(string $email, array $changes): bool
{
$allUsers = $this->getAllMailUsers();
$user = collect($allUsers)->firstWhere('email', $email);
if (!$user) {
return false;
}
return $this->call('mail_user_update', [
'primary_id' => $user['mailuser_id'],
'params' => $changes,
]);
}
}

View File

@@ -0,0 +1,26 @@
<?php
namespace App\Services\Nextcloud;
use Illuminate\Support\Facades\Http;
class NextcloudService
{
public function disableUserByEmail(string $email): bool
{
$username = $this->getUsernameFromEmail($email);
return Http::withBasicAuth(
config('services.nextcloud.username'),
config('services.nextcloud.password')
)->put(
config('services.nextcloud.base_url') . "/ocs/v1.php/cloud/users/{$username}/disable",
[]
)->successful();
}
protected function getUsernameFromEmail(string $email): string
{
return strstr($email, '@', true);
}
}