def task(self, isAdmin, s): if isAdmin == True: # If an admin, they can get whatever user they want i_key = self.request.get("i") # if no key specified, go to admin's personal account if i_key == "": i_key = tools.getUserKey(self) else: i_key = tools.getKey(i_key) else: # If a regular user, they can ONLY get their own profile i_key = tools.getUserKey(self) i = i_key.get() logging.info("Getting profile page for: " + i.name) # Creating a blobstore upload url upload_url = blobstore.create_upload_url('/ajax/profile/upload') template_variables = {"s": s, "i": i, "upload_url": upload_url, "isAdmin": isAdmin} self.response.write( template.render("pages/profile.html", template_variables))
def task(self, isAdmin, s): i_key = tools.getUserKey(self) i = i_key.get() template_variables = {"i": i} self.response.write( template.render('pages/mobile.html', template_variables))
def task(self, isAdmin, s): i = tools.getUserKey(self).get() template_variables = {"teams": None, "individual_name": i.name, "individual_key": i.key.urlsafe(), "teams": s.data.all_teams} self.response.write( template.render('pages/offline.html', template_variables))
def task(self, isAdmin, s): donation_key = self.request.get("id") if donation_key == "": # If they didn't type any arguments into the address bar - meaning it didn't come from the app tools.giveError(self, 500) else: # Getting donation by its key (from address bar argument) d = tools.getKey(donation_key).get() c = d.contact.get() i_key = tools.getUserKey(self) i = i_key.get() donation_date = [d.donation_date.day, d.donation_date.month, d.donation_date.year] donation_date = json.dumps(donation_date) template_variables = {"d": d, "c": c, "s": s, "i": i, "donation_date": donation_date} self.response.write( template.render('pages/rq_details.html', template_variables))
def individual_delete(self, req): message = "Individual deleted" success = True isAdmin, s = tools.checkAuthentication(self, True, from_endpoints=True) user_key = tools.getUserKey(self) isAdmin = user_key.get().admin i_key = tools.getKey(req.individual_key) if isAdmin == True: i_key.delete() else: if user_key == individual_key: i_key.delete() else: # Access denied - non-admin trying to delete someone else message = "Failed - Access denied" success = False return SuccessMessage_Out(success=success, message=message)