summaryrefslogtreecommitdiff
path: root/misc/freeswitch/scripts/dialplan/user.lua
diff options
context:
space:
mode:
authorspag <spag@golwen.net>2013-02-21 14:40:11 +0100
committerspag <spag@golwen.net>2013-02-21 14:40:11 +0100
commit56d9979b231af7d46f6b06f693fbf9820dcd73aa (patch)
tree004f7ffcbfad972b51936033557e00bc830315fb /misc/freeswitch/scripts/dialplan/user.lua
parentaee59991ee59c6b3a49133ca1afa080d0ead6440 (diff)
pickup groups
Diffstat (limited to 'misc/freeswitch/scripts/dialplan/user.lua')
-rw-r--r--misc/freeswitch/scripts/dialplan/user.lua17
1 files changed, 17 insertions, 0 deletions
diff --git a/misc/freeswitch/scripts/dialplan/user.lua b/misc/freeswitch/scripts/dialplan/user.lua
index b536600..b6928b4 100644
--- a/misc/freeswitch/scripts/dialplan/user.lua
+++ b/misc/freeswitch/scripts/dialplan/user.lua
@@ -69,6 +69,23 @@ function User.list_groups(self, id)
end
+function User.list_group_ids(self, id)
+ require 'common.str'
+ id = id or self.id;
+ local sql_query = 'SELECT `b`.`id` FROM `user_group_memberships` `a` \
+ JOIN `user_groups` `b` ON `a`.`user_group_id` = `b`.`id` \
+ WHERE `a`.`state` = "active" AND `a`.`user_id`= ' .. tonumber(id) .. ' ORDER BY `b`.`position` LIMIT ' .. MAX_GROUP_MEMBERSHIPS;
+
+ local groups = {};
+
+ self.database:query(sql_query, function(entry)
+ table.insert(groups, common.str.downcase(entry.id));
+ end);
+
+ return groups;
+end
+
+
function User.check_pin(self, pin_to_check)
if not self.record then
return nil