added client get users command
[ga4php.git] / gaas / lib / gaasdMessages.php
index a9c6460..94fb8c0 100644 (file)
@@ -11,8 +11,21 @@ function gaasStatus_server($messages)
        $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;
 }
 
@@ -139,16 +152,58 @@ function gaasSetADLogin_server($msg)
 
 function gaasSetAdminGroup_server($msg)
 {
-       confSetVal("ad.admindef", $msg["admingroup"]);
+       if(confGetVal("backend") == "AD") {
+               confSetVal("ad.admindef", $msg["admingroup"]);
+       } else return false;
        
        return true;
 }
 
 function gaasSetClientGroup_server($msg)
 {
-       confSetVal("ad.clientdef", $msg["clientgroup"]);
+       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;
+}
+
+function gaasGetUsers_server($msg)
+{
+       $haveTokens = $msg["havetokens"];
+       $userPatter = $msg["userpattern"];
+       $group = $msg["group"];
+       
+       if(confGetval("backend") == "AD") {
+               $adgroup = "";
+               if($group == "admin") {
+                       $adgroup = confGetVal("ad.admindef");
+               } else {
+                       $adgroup = confGetVal("ad.clientdef");
+               }
+               $addom = confGetVal("ad.domain");
+               $aduser = confGetVal("ad.user");
+               $adpass = confGetVal("ad.pass");
+               echo "using group $adgroup for $group\n";
+               
+               $users = getUsersInGroup($addom, $aduser, $adpass, $adgroup);
+       } else {
+               // internal db
+       }       
+       return $users;
+}
 ?>
\ No newline at end of file