def me(self): if (request.method == "GET"): cookie = request.cookies.get("GFB_Cookie") if (cookie == None): return '' else: decode = Cookie.decryptCookie(cookie) return json.dumps(decode) else: #open host site cookie = request.cookies.get("GFB_Cookie") if (cookie == None): return '' else: encode = {} decode = Cookie.decryptCookie(cookie) encode['role'] = decode['role'] encode['user_name'] = decode['user_name'] encode['email'] = decode['email'] if (request.params['changed'] == 'true'): encode['host_site'] = request.params['siteID'] else: encode['host_site'] = '' cookie = Cookie(encode['user_name'], encode['email'], encode['role'], encode['host_site']) response.delete_cookie('GFB_Cookie') response.set_cookie("GFB_Cookie", cookie.encryptCookie(), max_age=180 * 24 * 3600) return render('/tools/distOrders.mako')
def me(self): if (request.method == "GET"): cookie = request.cookies.get("GFB_Cookie") if(cookie == None): return '' else: decode = Cookie.decryptCookie(cookie) return json.dumps(decode) else: #open host site cookie = request.cookies.get("GFB_Cookie") if(cookie == None): return '' else: encode = {} decode = Cookie.decryptCookie(cookie) encode['role'] = decode['role'] encode['user_name'] = decode['user_name'] encode['email'] = decode['email'] if (request.params['changed'] == 'true'): encode['host_site'] = request.params['siteID'] else: encode['host_site'] = '' cookie = Cookie(encode['user_name'],encode['email'], encode['role'], encode['host_site']) response.delete_cookie('GFB_Cookie') response.set_cookie("GFB_Cookie", cookie.encryptCookie(), max_age=180*24*3600) return render('/tools/distOrders.mako')
def me(self): cookie = request.cookies.get("FCS_GFB_Cookie") if(cookie == None): return '' else: decode = Cookie.decryptCookie(cookie) return decode
def me(self): cookie = request.cookies.get("FCS_GFB_Cookie") if (cookie == None): return '' else: decode = Cookie.decryptCookie(cookie) return decode
def auth(self): db = DB() if (request.method == "GET"): # Check if user's email and password are matched success = db.authUser(request.params['email'], request.params['password']) if(success): # Setup the cookie (encrypted) with useful information user = db.getUser(request.params['email']) cookie = Cookie(user.get('first_name'), user.get('email'), user.get('fk_credentials'), user.get('fk_hostsite_id')) response.set_cookie("GFB_Cookie", cookie.encryptCookie(), max_age=180*24*3600) return self.trueString else: return "{\"success\" : \"false\", \"message\" : \"Unable to login: bad username or password\"}" else: return "{\"success\" : \"false\", \"message\" : \"Bad request.\"}"
def dashboard(self): cookie = request.cookies.get("GFB_Cookie") if(cookie == None): response.status_int = 404 return else: creds = Cookie.decryptCookie(cookie) return render('/tools/dashboard.mako')
def dashboard(self): cookie = request.cookies.get("GFB_Cookie") if (cookie == None): response.status_int = 404 return else: creds = Cookie.decryptCookie(cookie) return render('/tools/dashboard.mako')
def manageHS(self): #look at cookie cookie = request.cookies.get("FCS_GFB_Cookie") if (cookie == None): return "{\"success\":\"false\", \"message\":\"You must be logged in to see this page\"}" else: creds = Cookie.decryptCookie(cookie) if (creds.get('role') == '2') or (creds.get('role') == '1'): return render("/tools/manageHS.mako") else: return "{\"success\":\"false\", \"message\":\"You must be a coordinator or administrator to see this page\"}"
def auth(self): db = DB() if (request.method == "GET"): # authenticate with the database controller, assume that login is setting request params with username and password # I want the role # success = authUser(email, password) success = True if(success): # role, username, password # user = db.getUser() # cookie = Cookie(email, password, user.get('role')) cookie = Cookie('miakilborn', 'thisismypassword!', '1') response.set_cookie("FCS_GFB_Cookie", cookie.encryptCookie(), max_age=180*24*3600) return true_string else: return "{\"success\" : \"false\", \"message\" : \"Unable to login: bad username or password\"}" else: return "{\"success\" : \"false\", \"message\" : \"\"}"
def manageHS(self): #look at cookie cookie = request.cookies.get("FCS_GFB_Cookie") if(cookie == None): return "{\"success\":\"false\", \"message\":\"You must be logged in to see this page\"}" else: creds = Cookie.decryptCookie(cookie) if(creds.get('role') == '2') or (creds.get('role') == '1'): return render("/tools/manageHS.mako"); else: return "{\"success\":\"false\", \"message\":\"You must be a coordinator or administrator to see this page\"}"
def cashsales(self): cookie = request.cookies.get("GFB_Cookie") if(cookie == None): response.status_int = 404 return else: creds = Cookie.decryptCookie(cookie) if (creds.get('role') == '1') or (creds.get('role') == '2') or (creds.get('role') == '3'): return render('/tools/cashSales.mako') else: response.status_int = 404 return
def manageHS(self): cookie = request.cookies.get("GFB_Cookie") if(cookie == None): response.status_int = 404 return else: creds = Cookie.decryptCookie(cookie) if(creds.get('role') == '3' or creds.get('role') == '2' or creds.get('role') == '1'): return render("/tools/manageHS.mako"); else: response.status_int = 404 return
def auth(self): db = DB() if (request.method == "GET"): # Check if user's email and password are matched success = db.authUser(request.params['email'], request.params['password']) if (success): # Setup the cookie (encrypted) with useful information user = db.getUser(request.params['email']) cookie = Cookie(user.get('first_name'), user.get('email'), user.get('fk_credentials'), user.get('fk_hostsite_id')) response.set_cookie("GFB_Cookie", cookie.encryptCookie(), max_age=180 * 24 * 3600) return self.trueString else: return "{\"success\" : \"false\", \"message\" : \"Unable to login: bad username or password\"}" else: return "{\"success\" : \"false\", \"message\" : \"Bad request.\"}"
def masterCustList(self): #look at cookie cookie = request.cookies.get("GFB_Cookie") if(cookie == None): response.status_int = 404 return else: creds = Cookie.decryptCookie(cookie) if (creds.get('role') == '2') or (creds.get('role') == '1'): return render('/tools/masterCustList.mako') else: response.status_int = 404 return
def masterCustList(self): #look at cookie cookie = request.cookies.get("GFB_Cookie") if (cookie == None): response.status_int = 404 return else: creds = Cookie.decryptCookie(cookie) if (creds.get('role') == '2') or (creds.get('role') == '1'): return render('/tools/masterCustList.mako') else: response.status_int = 404 return
def manageAccounts(self): cookie = request.cookies.get("GFB_Cookie") if (cookie == None): response.status_int = 404 return else: creds = Cookie.decryptCookie(cookie) if (creds.get('role') == '2') or (creds.get('role') == '1'): return render('/tools/manageAccounts.mako') else: response.status_int = 404 return
def manageHS(self): cookie = request.cookies.get("GFB_Cookie") if (cookie == None): response.status_int = 404 return else: creds = Cookie.decryptCookie(cookie) if (creds.get('role') == '3' or creds.get('role') == '2' or creds.get('role') == '1'): return render("/tools/manageHS.mako") else: response.status_int = 404 return
def auth(self): db = DB() if (request.method == "GET"): # authenticate with the database controller, assume that login is setting request params with username and password # I want the role # success = authUser(email, password) success = True if (success): # role, username, password # user = db.getUser() # cookie = Cookie(email, password, user.get('role')) cookie = Cookie('miakilborn', 'thisismypassword!', '1') response.set_cookie("FCS_GFB_Cookie", cookie.encryptCookie(), max_age=180 * 24 * 3600) return true_string else: return "{\"success\" : \"false\", \"message\" : \"Unable to login: bad username or password\"}" else: return "{\"success\" : \"false\", \"message\" : \"\"}"
def customers(self): cookie = request.cookies.get("GFB_Cookie") if (cookie == None): response.status_int = 404 return else: creds = Cookie.decryptCookie(cookie) if (creds.get('role') == '2') or (creds.get('role') == '1'): db = DB() customerList = db.getAllCustomers() return Sale.toTableMasterCustomerList(customerList) else: response.status_int = 404 return
def distribution(self): #look at cookie cookie = request.cookies.get("GFB_Cookie") if(cookie == None): response.status_int = 404 return else: creds = Cookie.decryptCookie(cookie) if ((creds.get('role') == '3') or (creds.get('role') == '2') or (creds.get('role') == '1')) : return render('/tools/distOrders.mako') else: response.status_int = 404 return
def donors(self): cookie = request.cookies.get("GFB_Cookie") if (cookie == None): response.status_int = 404 return else: creds = Cookie.decryptCookie(cookie) if (creds.get('role') == '1' or creds.get('role') == '2'): db = DB() donorList = db.getDonationOrders() return Sale.toTableDonations(donorList) else: response.status_int = 404 return
def customers(self): cookie = request.cookies.get("GFB_Cookie") if cookie == None: response.status_int = 404 return else: creds = Cookie.decryptCookie(cookie) if (creds.get("role") == "2") or (creds.get("role") == "1"): db = DB() customerList = db.getAllCustomers() return Sale.toTableMasterCustomerList(customerList) else: response.status_int = 404 return
def donors(self): cookie = request.cookies.get("GFB_Cookie") if cookie == None: response.status_int = 404 return else: creds = Cookie.decryptCookie(cookie) if creds.get("role") == "1" or creds.get("role") == "2": db = DB() donorList = db.getDonationOrders() return Sale.toTableDonations(donorList) else: response.status_int = 404 return
def sales(self): #look at cookie cookie = request.cookies.get("FCS_GFB_Cookie") if(cookie == None): print "There is no cookie for user" # return None return "list of cash sales in JSONO format"; else: creds = Cookie.decryptCookie(cookie) if(creds.get('role') == '2') or (creds.get('role') == '1'): #This will need to be updated when the front end knows what parms its using if (request.method == "GET"): order_list = None hostSiteID = request.params['hostSiteID'] beginDate = request.parms['beginDate'] endDate = request.parms['endDate'] paid = request.parms['paid']#may need to change this cancel = request.parms['cancel'] if cancel == True: #order_list = db.etAllCanceledOrdersByDistributionDate(beginDate,endDate) pass elif hostSiteID == None: if paid == True: # order_list = db.getAllPaidOrdersByDistributionDate(beginDate,endDate) pass elif paid == False: #order_list = db.getAllUnpaidOrdersByDistributionDate(beginDate, endDate) pass else: #order_list = db.getAllOrdersByDistributionDate(beginDate, endDate) pass else: if paid == True: # order_list = db.getPaidOrdersByDistributionDate(hostSiteID, beginDate, endDate) pass elif paid == False: #order_list = db.getUnpaidOrdersByDistributionDate(hostSiteID, beginDate, endDate) pass else: #order_list = db.getOrderByDistributionDate(hostSiteID, beginDate, endDate) pass #return json.dumps(order_list) return "order_list in json format" else: return None
def sales(self): #look at cookie cookie = request.cookies.get("FCS_GFB_Cookie") if (cookie == None): print "There is no cookie for user" # return None return "list of cash sales in JSONO format" else: creds = Cookie.decryptCookie(cookie) if (creds.get('role') == '2') or (creds.get('role') == '1'): #This will need to be updated when the front end knows what parms its using if (request.method == "GET"): order_list = None hostSiteID = request.params['hostSiteID'] beginDate = request.parms['beginDate'] endDate = request.parms['endDate'] paid = request.parms['paid'] #may need to change this cancel = request.parms['cancel'] if cancel == True: #order_list = db.etAllCanceledOrdersByDistributionDate(beginDate,endDate) pass elif hostSiteID == None: if paid == True: # order_list = db.getAllPaidOrdersByDistributionDate(beginDate,endDate) pass elif paid == False: #order_list = db.getAllUnpaidOrdersByDistributionDate(beginDate, endDate) pass else: #order_list = db.getAllOrdersByDistributionDate(beginDate, endDate) pass else: if paid == True: # order_list = db.getPaidOrdersByDistributionDate(hostSiteID, beginDate, endDate) pass elif paid == False: #order_list = db.getUnpaidOrdersByDistributionDate(hostSiteID, beginDate, endDate) pass else: #order_list = db.getOrderByDistributionDate(hostSiteID, beginDate, endDate) pass #return json.dumps(order_list) return "order_list in json format" else: return None
def distribution(self): #look at cookie cookie = request.cookies.get("GFB_Cookie") if (cookie == None): response.status_int = 404 return else: creds = Cookie.decryptCookie(cookie) if ((creds.get('role') == '3') or (creds.get('role') == '2') or (creds.get('role') == '1')): return render('/tools/distOrders.mako') else: response.status_int = 404 return
def donors(self): #look at cookie cookie = request.cookies.get("FCS_GFB_Cookie") if(cookie == None): print "There is no cookie for user" # return None return "list of donors in JSON format"; else: #analyze the cookie creds = Cookie.decryptCookie(cookie) if(creds.get('role') == '2'): return None elif (creds.get('role') == '1'): return "list of donors in JSON format"; else: return None
def donors(self): #look at cookie cookie = request.cookies.get("FCS_GFB_Cookie") if (cookie == None): print "There is no cookie for user" # return None return "list of donors in JSON format" else: #analyze the cookie creds = Cookie.decryptCookie(cookie) if (creds.get('role') == '2'): return None elif (creds.get('role') == '1'): return "list of donors in JSON format" else: return None
def customers(self): #look at cookie cookie = request.cookies.get("FCS_GFB_Cookie") if(cookie == None): print "There is no cookie for user" # return None return "customer list in JSON format" else: #List is based on C or A status creds = Cookie.decryptCookie(cookie) if(creds.get('role') == '2') or (creds.get('role') == '1'): customer_list = None #\this is a weird one. You need to get an order and filter out the customer return "customer list in JSON format" else: return None
def customers(self): #look at cookie cookie = request.cookies.get("FCS_GFB_Cookie") if (cookie == None): print "There is no cookie for user" # return None return "customer list in JSON format" else: #List is based on C or A status creds = Cookie.decryptCookie(cookie) if (creds.get('role') == '2') or (creds.get('role') == '1'): customer_list = None #\this is a weird one. You need to get an order and filter out the customer return "customer list in JSON format" else: return None