comparison mod_adhoc_cmd_admin/mod_adhoc_cmd_admin.lua @ 43:adc9eff8adb2

mod_adhoc, mod_adhoc_cmd_admin: Show only commands they may execute to the user
author Florian Zeitz <florob@babelmonkeys.de>
date Fri, 16 Oct 2009 01:36:04 +0200
parents 4c4daa1f8ae7
children 00f96207693a
comparison
equal deleted inserted replaced
42:bbb3d3a90a70 43:adc9eff8adb2
18 local adhoc_new = module:require "adhoc".new; 18 local adhoc_new = module:require "adhoc".new;
19 19
20 local sessions = {}; 20 local sessions = {};
21 21
22 local add_user_layout = dataforms_new{ 22 local add_user_layout = dataforms_new{
23 title= "Adding a User"; 23 title = "Adding a User";
24 instructions = "Fill out this form to add a user."; 24 instructions = "Fill out this form to add a user.";
25 25
26 { name = "FORM_TYPE", type = "hidden", value = "http://jabber.org/protocol/admin" }; 26 { name = "FORM_TYPE", type = "hidden", value = "http://jabber.org/protocol/admin" };
27 { name = "accountjid", type = "jid-single", required = true, label = "The Jabber ID for the account to be added" }; 27 { name = "accountjid", type = "jid-single", required = true, label = "The Jabber ID for the account to be added" };
28 { name = "password", type = "text-private", label = "The password for this account" }; 28 { name = "password", type = "text-private", label = "The password for this account" };
104 :add_child(field))); 104 :add_child(field)));
105 105
106 return true; 106 return true;
107 end 107 end
108 108
109 local add_user_desc = adhoc_new("Add User", "http://jabber.org/protocol/admin#add-user", add_user_command_handler); 109 local add_user_desc = adhoc_new("Add User", "http://jabber.org/protocol/admin#add-user", add_user_command_handler, "admin");
110 local get_online_users_desc = adhoc_new("Get List of Online Users", "http://jabber.org/protocol/admin#get-online-users", get_online_users_command_handler); 110 local get_online_users_desc = adhoc_new("Get List of Online Users", "http://jabber.org/protocol/admin#get-online-users", get_online_users_command_handler, "admin");
111 111
112 function module.unload() 112 function module.unload()
113 module:remove_item("adhoc", add_user_desc); 113 module:remove_item("adhoc", add_user_desc);
114 module:remove_item("adhoc", get_online_users_desc); 114 module:remove_item("adhoc", get_online_users_desc);
115 end 115 end