Esempio n. 1
0
        }
        if ($addChange) {
            $this->LogToFile($this->LDAP_LOGFILE, "lastChange is updated for : " . $this->inputs['alias'] . PHP_EOL);
        } else {
            throw new Exception("Error lastChange update : " . $this->inputs['alias']);
        }
    }
    /* longopts and shortopts and output parameters */
    private $outputLDAP = array("addDomain" => array("dn" => "vd=<domainname>,o=domains,dc=ispworks,dc=ww", "objectClass" => array("top", "VirtualDomain")), "addUser" => array("dn" => "uid=<username>,vd=<domainname>,o=domains,dc=ispworks,dc=ww", "objectClass" => array("top", "VirtualMail", "uidObject")), "modifyUser" => array("replace" => array("lastChange", "mail", "userPassword", "OXcontextID")));
    private $longoptsDomainsLDAP = array("add" => array("type:", "action:", "domainname:", "accountActive:", "lastChange:", "ldapserver:", "binddn:", "bindpwd:"), "delete" => array("type:", "action:", "domainname:", "ldapserver:", "binddn:", "bindpwd:"));
    private $longoptsUsersLDAP = array("add" => array("type:", "action:", "contextid:", "username:"******"password:"******"emailaddress:", "ldapserver:", "binddn:", "bindpwd:", "accountActive:", "lastChange:", "domainname:"), "modify" => array("type:", "action:", "contextid:", "username:"******"password:"******"emailaddress:", "ldapserver:", "binddn:", "bindpwd:", "lastChange:", "domainname:"), "delete" => array("type:", "action:", "contextid:", "username:"******"emailaddress:", "ldapserver:", "binddn:", "bindpwd:", "domainname:"));
    private $longoptsAliasesLDAP = array("add" => array("type:", "action:", "username:"******"emailaddress:", "alias:", "ldapserver:", "binddn:", "bindpwd:", "domainname:", "lastChange:"), "delete" => array("type:", "action:", "username:"******"emailaddress:", "alias:", "ldapserver:", "binddn:", "bindpwd:", "domainname:", "lastChange:"));
}
try {
    $ldap = new LDAP();
    $opts = $ldap->validateInputs(Base::$shortopts, Base::$longopts);
    $ldap->processAction($opts);
} catch (Exception $e) {
    $ldap->LogToFile($ldap->ERR_LOGFILE, $e->getMessage() . PHP_EOL);
    die(1);
}
/*
=======
 * Add user
 * 
 * php LDAP.php --type users --action add --contextid 1 --username dudan --password 123 --emailaddress ccc@gmail.com --ldapserver 89.184.172.223:389 --binddn cn=admin,dc=ispworks,dc=ww --bindpwd secret --accountActive TRUE --lastChange 1414 --domainname primer.com
 * 
 * Modify user
 * 
 * php LDAP.php --type users --action modify --contextid 1 --username dudan --password 123 --emailaddress ccc@gmail.com --ldapserver 89.184.172.223:389 --binddn cn=admin,dc=ispworks,dc=ww --bindpwd secret --lastChange 14141 --domainname primer.com
 *