Files
Sentri/pub/api/v1/customers/companies/activate/index.php
2026-01-01 10:54:18 +01:00

29 lines
755 B
PHP

<?php
use api\classes\API_companies;
session_start();
require_once $_SERVER['DOCUMENT_ROOT'] . '/api/classes/API_companies.php';
# Check permissions
$API_companies = new API_companies();
if ($API_companies->request_method === 'PUT') {
$API_companies->checkPermissions('customer-companies', 'RW');
# when called from the frontend will not be forwarding to a url since when its called from the frontend it doesnt need a redirection
$API_companies->return_url = false;
$requiredFields = [
'company_uuid' => ['type' => 'uuid'],
'company_state' => ['type' => 'enum', 'values' => ['active', 'imported', 'orphaned']]
];
$API_companies->validateData($requiredFields);
$API_companies->updateCompanyState();
}