Example #1
0
    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')
Example #2
0
	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')
Example #3
0
	def me(self):
		cookie = request.cookies.get("FCS_GFB_Cookie")	
		if(cookie == None):
			return ''
		else:
			decode = Cookie.decryptCookie(cookie)
			return decode
Example #4
0
 def me(self):
     cookie = request.cookies.get("FCS_GFB_Cookie")
     if (cookie == None):
         return ''
     else:
         decode = Cookie.decryptCookie(cookie)
         return decode
Example #5
0
	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.\"}"
Example #6
0
	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')
Example #7
0
 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')
Example #8
0
 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\"}"
Example #9
0
	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\" : \"\"}"
Example #10
0
	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\"}"
Example #11
0
	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
Example #12
0
	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
Example #13
0
    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.\"}"
Example #14
0
	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
Example #15
0
 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
Example #16
0
    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
Example #17
0
 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
Example #18
0
    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\" : \"\"}"
Example #19
0
 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
Example #20
0
	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
Example #21
0
 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
Example #22
0
 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
Example #23
0
 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
Example #24
0
	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
Example #25
0
    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
Example #26
0
    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
Example #27
0
	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
Example #28
0
 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
Example #29
0
	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
Example #30
0
    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