[Freeswitch-trunk] [commit] r12663 - freeswitch/trunk/scripts/contrib/swk/php/xml_curl
FreeSWITCH SVN
silik0n at freeswitch.org
Wed Mar 18 18:55:58 PDT 2009
Author: silik0n
Date: Wed Mar 18 20:55:58 2009
New Revision: 12663
Log:
fix user groups
Modified:
freeswitch/trunk/scripts/contrib/swk/php/xml_curl/FSDirectory.php
freeswitch/trunk/scripts/contrib/swk/php/xml_curl/directory.php
Modified: freeswitch/trunk/scripts/contrib/swk/php/xml_curl/FSDirectory.php
==============================================================================
--- freeswitch/trunk/scripts/contrib/swk/php/xml_curl/FSDirectory.php (original)
+++ freeswitch/trunk/scripts/contrib/swk/php/xml_curl/FSDirectory.php Wed Mar 18 20:55:58 2009
@@ -142,6 +142,13 @@
return $results;
}
+ public function getDirGroupsByDomianUidByUserUid($domain_uid, $user_uid){
+ $query = sprintf("select a.uid as groupUid, a.name as groupName, b.uid as usersUid from groups as a, group_members as b where a.uid = b.groups_uid and b.domains_uid = %s and b.users_uid = %s", $domain_uid, $user_uid) ;
+ $stmt = $this->dbh->query($query);
+ $results = $stmt->fetchAll();
+ return $results;
+ }
+
}
/* For Emacs:
* Local Variables:
Modified: freeswitch/trunk/scripts/contrib/swk/php/xml_curl/directory.php
==============================================================================
--- freeswitch/trunk/scripts/contrib/swk/php/xml_curl/directory.php (original)
+++ freeswitch/trunk/scripts/contrib/swk/php/xml_curl/directory.php Wed Mar 18 20:55:58 2009
@@ -19,6 +19,7 @@
$key_value="192.168.1.140";
$user="1000";
*/
+
if ($section == "directory" && $tag_name == "domain" && $key_name == "name") {
$db_domain = $fsd->getDirDomainbyName($key_value);
} else {
@@ -31,7 +32,7 @@
$db_user_settings = $fsd->getDirUser($db_user['uid']);
-$db_groups = $fsd->getDirGroups($db_domain['uid']);
+$db_groups = $fsd->getDirGroupsByDomianUidByUserUid($db_domain['uid'], $db_user['uid']);
printf(" <?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n");
printf(" <document type=\"freeswitch/xml\">\n");
@@ -54,18 +55,14 @@
printf(" </user>\n");
printf(" </users>\n");
printf(" </group>\n");
-/* This is Broken need to talk to someone about this part... maybe I should load this at boot time instead
foreach($db_groups as $db_group){
- $db_members = $fsd->getDirGroup($db_group['uid']);
- printf(" <group name=\"%s\">\n", $db_group['name']);
+ printf(" <group name=\"%s\">\n", $db_group['groupName']);
printf(" <users>\n");
- foreach($db_members['members'] as $db_member){
- printf(" <user id=\"%s\" type=\"pointer\"/>\n", $db_member['usersUsername']);
- }
+ printf(" <user id=\"%s\" type=\"pointer\"/>\n", $user);
printf(" </users>\n");
printf(" </group>\n");
}
-*/
+
printf(" </groups>\n");
printf(" </domain>\n");
printf(" </section>\n");
More information about the Freeswitch-trunk
mailing list