indexing description: "User set icon use case." author: "Marco Zietzling " date: "$Date$" revision: "$Revision$" class USER_SET_ICON inherit AUTH_USE_CASE O_USER_CONSTANTS O_CONFIG_CONSTANTS create make feature -- Access namespace: STRING is -- Namespace of this use case. once Result := user_namespace end type: STRING is -- Message type of this use case. once Result := user_set_icon_type end feature -- Basic operation start (a_msg: O_MESSAGE) is -- Start the use case by a_msg. local l_msg: O_SESSION_MESSAGE do l_msg ?= a_msg check session_message: l_msg /= Void end -- check if the user is authorized and act accordingly is_authorized_for_project (l_msg, "user_set_information", 0, auth_node) end feature {NONE} -- Callbacks handle_auth_success (a_msg: O_MESSAGE) is -- a_msg has been authorized, execute it. local l_user_set_icon_message: O_USER_SET_ICON_MESSAGE l_user_my_name_message: O_USER_MY_NAME_MESSAGE do l_user_set_icon_message ?= a_msg check valid_message: l_user_set_icon_message /= Void end -- send message to storage node to get the corresponding user name create l_user_my_name_message.make (l_user_set_icon_message.session) l_user_my_name_message.set_reply_handler (agent process_storage_user_name_reply (?, a_msg)) node.send_message_node (l_user_my_name_message, "storage1") end process_storage_user_name_reply (a_msg, an_orig_msg: O_MESSAGE) is -- Process reply from storage node. Reply includes user_name. require a_msg_not_void: a_msg /= Void an_orig_msg_not_void: an_orig_msg /= Void local l_user_set_icon_message: O_USER_SET_ICON_MESSAGE l_string_message: O_GENERAL_STRING_MESSAGE l_config_command_message: O_GENERIC_MESSAGE l_username: STRING l_icon: STRING do l_user_set_icon_message ?= an_orig_msg check valid_message: l_user_set_icon_message /= Void end l_string_message ?= a_msg check valid_message: l_string_message /= Void end l_username := l_string_message.string l_icon := l_user_set_icon_message.icon -- send message to config node to move user icon create l_config_command_message.make (config_namespace, config_user_icon_delete_type) l_config_command_message.add_argument (l_icon, "/usr/local/lib/origo/origo-user-icon-move.sh " + l_username.out + " %"" + l_icon.out + "%"") node.send_message_node (l_config_command_message, "config1") -- forward message to storage node to store filename in DB forward_to_node (l_user_set_icon_message, "storage1") end end