Rev 404 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed
'''Created on 28-Apr-2010@author: ashish'''from shop2020.utils.Utils import log_entryfrom shop2020.model.v1.user.impl.DataAccessors import add_social_handle,\delete_user, update_password, set_user_as_logged_out, set_user_as_logged_in,\remove_address_for_user, add_address_for_user, add_ip_address_for_user,\user_exists, authenticate_user, get_context, get_internal_info,\get_primary_info, get_state, get_context_by_email_or_handle,\get_context_by_session_id, get_context_by_id, create_context, update_contextfrom shop2020.model.v1.user.impl.Converters import to_t_user_context,\to_t_internal_info, to_t_primary_info, to_t_user_stateclass UserContextServiceHandler:"""User session context service handler"""def createContext(self, context, updateExisting):"""Parameters:- context- updateExisting"""log_entry(self, "create or update context")if not updateExisting:id = create_context(context)else:id = update_context(context)return to_t_user_context(get_context_by_id(id))passdef getContextFromId(self, userId, isSessionId):"""Parameters:- userId- isSessionId"""log_entry(self, "get context from id")if isSessionId:return to_t_user_context(get_context_by_session_id(userId))else:return to_t_user_context(get_context_by_id(userId))passdef getContextFromEmailOrHandle(self, emailorhandle, isEmail):"""Parameters:- emailorhandle- isEmail"""log_entry(self, "get context from email or handle")return to_t_user_context(get_context_by_email_or_handle(emailorhandle, isEmail))passdef getState(self, userId, isSessionId):"""Parameters:- userId- isSessionId"""log_entry(self, "get State")return to_t_user_state(get_state(userId, isSessionId))passdef getPrimaryInfo(self, userId, isSessionId):"""Parameters:- userId- isSessionId"""log_entry(self, "get primary info")return to_t_primary_info(get_primary_info(userId, isSessionId))passdef getInternalInfo(self, userId, isSessionId):"""Parameters:- userId- isSessionId"""log_entry(self, "get internal info")return to_t_internal_info(get_internal_info(userId, isSessionId))passdef getContext(self, email, password):"""Parameters:- password"""log_entry(self, "get context")return to_t_user_context(get_context(email, password))passdef authenticateUser(self, handle, password, isEmail):"""Parameters:- handle- password- isEmail"""log_entry(self, "authenticate user")return authenticate_user(handle, password)passdef userExists(self, email):"""Parameters:"""log_entry(self, "user exists")return user_exists(email)passdef addIpAdressForUser(self, ip, timestamp, userId):"""Parameters:- ip- timestamp- userId"""log_entry(self, "add ipaddress for user")return add_ip_address_for_user(ip, timestamp, userId)passdef addAddressForUser(self, address, userid, timestamp):"""Parameters:- address- userid- timestamp"""log_entry(self, "add address for user")return add_address_for_user(address, userid, timestamp)passdef removeAddressForUser(self, userid, addressId):"""Parameters:- userid- addressId"""log_entry(self, "removing address")return remove_address_for_user(userid, addressId)passdef setUserAsLoggedIn(self, userId, timestamp):"""Parameters:- userId- timestamp"""log_entry(self, "set_user_as_logged_in")return set_user_as_logged_in(userId, timestamp)passdef setUserAsLoggedOut(self, userid, timestamp):"""Parameters:- userid- timestamp"""log_entry(self, "set user as logged out")return set_user_as_logged_out(userid, timestamp)passdef updatePassword(self, userid, password):"""Parameters:- userid- password"""log_entry(self, "updating password")return update_password(userid, password)passdef deleteUser(self, userid, isSessionId):"""Parameters:- userid- isSessionId"""log_entry(self, "Deleting user")return delete_user(userid, isSessionId)def sendEmailVerification(self, userid):"""Parameters:- userid"""passdef sendSMSVerification(self, userid):"""Parameters:- userid"""passdef confirmEmailVerification(self, userid):"""Parameters:- userid"""passdef confirmSMSVerification(self, userid):"""Parameters:- userid"""passdef addSocialhandle(self, userid, socialService, handle):"""Parameters:- userid- socialService- handle"""log_entry(self, "adding social handle")return add_social_handle(userid, socialService, handle)def sendNewPasswordById(self, userid):"""Parameters:- userid"""passdef sendNewPasswordByHandle(self, emailOrHandle, isEmail):"""Parameters:- emailOrHandle- isEmail"""pass