$return = "init";
if($initState != false && $backEnd != "") {
$return = "running";
+ $be = confGetVal("backend");
+ if($be == "AD") {
+ $dom = confGetVal("ad.domain");
+ $user = confGetVal("ad.user");
+ $client = confGetVal("ad.clientdef");
+ $admin = confGetVal("ad.admindef");
+ $return .= " - AD integrated to $dom, GAASD Username: $user, Clients Group: $client, Admins Group: $admin";
+ } else {
+ $return .= " - internal database";
+ }
+
}
+
+
return $return;
}
// IN expects
// $m["user"] = "someuser";
// $m["pass"] = "somepass";
- echo "initstate is $initState\n";
+ echo "initstate is $initState";
if($initState) {
echo "true\n";
} else {
// we should check all servers, but lets just go with 0 for now
$res = adTestLogin($addom, $adlogin, $adpass);
if(!$res) {
- echo "AD login test failed\n";
return false;
- } else {
- echo "AD login test succeeded\n";
}
confSetVal("ad.encryptionkey", generateHexString(32));
confSetVal("ad.clientdef", $adclientdef);
confSetVal("ad.admindef", $adadmindef);
+ confSetVal("backend", "AD");
$initState = true;
$backEnd = "AD";
// and that should be it... i think cept im in a forked erg.. lets assume it works, need pain i do not.
-
return true;
} else if($msg["backend"] == "IN") {
// this ones simpler
$addom = $msg["domain"];
$adlogin = $msg["user"];
$adpass = $msg["pass"];
- $adclientdef = $msg["clientdef"];
- $adadmindef = $msg["admindef"];
$res = adTestLogin($addmo, $adlogin, $adpass);
if($res != 0) {
confSetVal("ad.domain", $addom);
confSetVal("ad.user", $adlogin);
confSetVal("ad.pass", $adpass);
- confSetVal("ad.clientdef", $adclientdef);
- confSetVal("ad.admindef", $adadmindef);
return true;
}
+
+function gaasSetAdminGroup_server($msg)
+{
+ if(confGetVal("backend") == "AD") {
+ confSetVal("ad.admindef", $msg["admingroup"]);
+ } else return false;
+
+ return true;
+}
+
+function gaasSetClientGroup_server($msg)
+{
+ if(confGetVal("backend") == "AD") {
+ confSetVal("ad.clientdef", $msg["clientgroup"]);
+ } else return false;
+
+ return true;
+}
+
+function gaasProvisionUser_server($msg)
+{
+
+ // function userInGroup($user, $domain, $adlogin, $adpass, $group)
+ if(confGetVal("backend") == "AD") {
+ userInGroup($msg["username"], confGetVal("ad.domain"), confGetVal("ad.user", $adlogin), confGetVal("ad.pass"), confGetVal("ad.clientdef"));
+ } else {
+ // internal db
+ }
+
+
+ return true;
+}
+
?>
\ No newline at end of file