2024-04-04 22:21:20 +04:00
|
|
|
<?php
|
|
|
|
namespace nur\ldap\app;
|
|
|
|
|
|
|
|
use nur\ldap\LdapSearch;
|
|
|
|
use nur\ldap\LdapWalker;
|
2024-05-03 10:17:23 +04:00
|
|
|
use nur\sery\output\msg;
|
2024-04-04 22:21:20 +04:00
|
|
|
|
|
|
|
class LdapDeleteApp extends LdapApplication {
|
|
|
|
const ARGS = [
|
|
|
|
"merge" => parent::ARGS,
|
|
|
|
["-s", "--scope", "args" => 1],
|
|
|
|
["-b", "--searchbase", "args" => 1],
|
|
|
|
["-B", "--searchbase-exact", "args" => 1],
|
|
|
|
];
|
|
|
|
|
|
|
|
protected $scope;
|
|
|
|
protected $searchbase, $searchbaseExact;
|
|
|
|
protected $args;
|
|
|
|
|
|
|
|
function main() {
|
|
|
|
$conn = $this->getConn();
|
|
|
|
|
|
|
|
$params = [];
|
|
|
|
LdapSearch::parse_args($params, $this->args
|
|
|
|
, $this->searchbase, $this->searchbaseExact
|
|
|
|
, $this->scope);
|
|
|
|
/** @var LdapWalker $lo */
|
|
|
|
$lo = $conn->search(null, $params);
|
|
|
|
while ($lo->next($first)) {
|
2024-05-03 10:17:23 +04:00
|
|
|
msg::action("Suppression $lo[dn]");
|
2024-04-04 22:21:20 +04:00
|
|
|
$lo->delete();
|
2024-05-03 10:17:23 +04:00
|
|
|
msg::asuccess();
|
2024-04-04 22:21:20 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|