12 private array $settings;
14 private string $action;
19 $this->settings = $settings;
27 $this->userid = $userid;
36 $this->action =
"deactivate";
46 $this->action =
"reactivate";
55 public function lock(): void {
56 $this->action =
"lock";
65 $this->action =
"unlock";
72 private function request(): void {
73 $token = $this->settings[
"serviceUserToken"];
76 curl_setopt_array($curl, array(
77 CURLOPT_URL => $this->settings[
"domain"] .
"/v2beta/users/$this->userid/$this->action",
78 CURLOPT_RETURNTRANSFER =>
true,
79 CURLOPT_ENCODING =>
'',
80 CURLOPT_MAXREDIRS => 10,
82 CURLOPT_FOLLOWLOCATION =>
true,
83 CURLOPT_CUSTOMREQUEST =>
'POST',
84 CURLOPT_POSTFIELDS =>
"{}",
85 CURLOPT_HTTPHEADER => array(
86 "Content-Type: application/json",
87 "Accept: application/json",
88 "Authorization: Bearer $token"
92 $response = json_decode(curl_exec($curl));
94 if(isset($response->code)) {
95 throw new Exception(
"Error-Code: " . $response->code .
" Message: " . $response->message);