indexing description: "Project change group use case." author: "Patrick Ruckstuhl " date: "$Date$" revision: "$Revision$" class PROJECT_CHANGE_GROUP inherit AUTH_USE_CASE O_PROJECT_CONSTANTS O_CONFIG_CONSTANTS create make feature -- Access namespace: STRING is -- Namespace of this use case. once Result := project_namespace end type: STRING is -- Message type of this use case. once Result := project_change_group_type end feature -- Basic operation start (a_msg: O_MESSAGE) is -- Start the use case by a_msg. local l_msg: O_PROJECT_CHANGE_GROUP_MESSAGE do l_msg ?= a_msg check valid_message: l_msg /= Void end -- check if the user is authorized and act accordingly is_authorized_for_project (l_msg, "project_change_group", l_msg.project, auth_node) end feature {NONE} -- Implementation handle_auth_success (a_msg: O_MESSAGE) is -- a_msg has been authorized, execute it. local l_msg: O_PROJECT_CHANGE_GROUP_MESSAGE l_project_msg: O_PROJECT_MESSAGE l_conf: O_GENERIC_MESSAGE do l_msg ?= a_msg check valid_message: l_msg /= Void end forward_to_node (a_msg, "storage1") -- also regenerate svn configuration create l_conf.make (config_namespace, config_svn_type) l_conf.set_reply_handler (agent forward_to_node (?, "config1")) node.send_message_node (l_conf, "storage1") -- also regenerate ftp configuration create l_conf.make (config_namespace, config_ftp_type) l_conf.set_reply_handler (agent forward_to_node (?, "config1")) node.send_message_node (l_conf, "storage1") create l_conf.make (config_namespace, config_command_type) l_conf.add_argument ("pureftp", "/usr/bin/pure-pw mkdb") node.send_message_node (l_conf, "config1") -- update shared project roster, we need the project name instead of the id, so get the name create l_project_msg.make ("DUMMY", l_msg.project) l_project_msg.set_reply_handler(agent handle_project_name_reply (?, l_msg)) node.send_message_node (l_project_msg, "storage1") end handle_project_name_reply (a_msg: O_MESSAGE; a_orig_msg: O_PROJECT_CHANGE_GROUP_MESSAGE) is -- We got the project_id -> project_name reply. local l_msg: O_PROJECT_REPLY_MESSAGE l_conf: O_GENERIC_MESSAGE do l_msg ?= a_msg check valid_message: l_msg /= Void end -- removed create l_conf.make (config_namespace, config_command_type) if a_orig_msg.group = 0 then l_conf.add_argument ("ejabberdctl", "/usr/sbin/ejabberdctl srg-user-del " + a_orig_msg.user + " " + config_parser.get("jabber_domain") + " " + l_msg.name + " " + config_parser.get("jabber_domain")) -- added else l_conf.add_argument ("ejabberdctl", "/usr/sbin/ejabberdctl srg-user-add " + a_orig_msg.user + " " + config_parser.get("jabber_domain") + " " + l_msg.name + " " + config_parser.get("jabber_domain")) end node.send_message_node (l_conf, "config2") end end