wip(Resiliation script)
This commit is contained in:
26
app/Services/Nextcloud/NextcloudService.php
Normal file
26
app/Services/Nextcloud/NextcloudService.php
Normal 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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user