def get(): tag = {"name":"WARNING_SECOND", "value": 1, "controller_ip": "192.168.0.1", "time": "2014-10-20T11:32:33.744353"} installation = "66002174487292" installation_obj = installationHandler.get(installation, True) controller_obj = controllerHandler.get_controller(installation, tag['controller_ip'], True) customer_obj = customerHandler.get_customer(installation_obj['customer']) res = mailHandler.send_alarm_mail(tag, installation_obj, controller_obj, customer_obj) return OkResponse('Sent the mail!')
def get(customer_id=None): res = customerHandler.get_customer(customer_id) if res: if type(res) == list: statusHandler.set_status_for_customers(res) else: statusHandler.set_status_for_customer(res) return OkResponse(res) else: return ConflictResponse("Could not get the customer")
def allow_viewing(customer_id): result = False user = cherrypy.session.get("user") customer = customerHandler.get_customer(customer_id) if customer_id != None else None if customer and customer_id: if user_can_view_customer(user, customer): result = True if has_full_access(user): result = True return result
def allow_changes(customer_id): user = cherrypy.session.get("user") customer = customerHandler.get_customer(customer_id) if has_full_access(user): return True if user_is_master(user) and not user_is_admin(user): # master_user, check if customer can be edited if user_can_view_customer(user, customer): return True if user_can_view_customer(user, customer) and user_is_admin(user): return True return False