1. Go to this page and download the library: Download spkm/clear-pass library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
spkm / clear-pass example snippets
use spkm\ClearPass\Facades\ClearPass;
$guest = ClearPass::identities()->guestUsers()->create([
'username' => '[email protected]',
'password' => 'a-strong-password',
'role_id' => ClearPass::policyElements()->roles()->findByName('[Guest]')->id, // roles are your server's own
'expire_time' => now()->addDays(2),
'sponsor_name' => 'Reception',
]);
$expiring = ClearPass::identities()->guestUsers()
->where('sponsor_profile', 'API')
->where('expire_time', '<', now()->addDay())
->orderBy('expire_time')
->get();
foreach (ClearPass::sessionControl()->activeSessions()->where('ssid', 'Guest')->lazy() as $session) {
// one page of 100 at a time
}
$role = ClearPass::policyElements()->roles()->findByName('[Guest]'); // Role or null
$count = ClearPass::identities()->guestUsers()->where('enabled', true)->count();
$devices = ClearPass::policyElements()->networkDevices()->orderBy('name')->all(); // Collection of NetworkDevice
use spkm\ClearPass\Query\Query;
use spkm\ClearPass\Requests\Identities\GuestUser\GetGuestUsersRequest;
$response = ClearPass::send(new GetGuestUsersRequest(Query::make()->where('role_id', '=', 2)->limit(50)));
$response->status();
$response->json();
$response->dto(); // the same models the resource gives; throws ClearPassApiException for an error status
ClearPass::identities()->guestUsers()->find(12); // by id, null when there is none
ClearPass::identities()->guestUsers()->findByUsername('[email protected]');
ClearPass::identities()->guestUsers()->update(12, ['expire_time' => now()->addWeek()]);
ClearPass::identities()->guestUsers()->updateByUsername('[email protected]', ['enabled' => false], ['change_of_authorization' => 'true']);
ClearPass::identities()->guestUsers()->replace(12, $guest); // PUT: the whole record
ClearPass::identities()->guestUsers()->delete(12);
ClearPass::insight()->alerts()->enable(3); // the actions a service documents
ClearPass::enforcementProfile()->natPools('ArubaOS-CX')->get(); // a service scoped by a path parameter
ClearPass::guestConfiguration()->guestManager()->update(['...' => '...']);