Ejemplo n.º 1
0
	def get(self):
		self.response.headers['Content-Type'] = 'text/html'
		response = None
		user = users.get_current_user()
		
		if user:
			profile = profiles.get_user_profile()
			if not profile:
				self.redirect('/create-profile')
				return
		
		response = self.render_page(user)

		self.response.out.write(response)
Ejemplo n.º 2
0
	def get(self):
		if not privileges.can_access_page():
			self.redirect(privileges.get_redirect_url())
			return
		
		profile = profiles.get_user_profile()
		
		if users.get_current_user() is None:
			self.redirect('/')
		elif not profile:
			self.redirect('/create-profile');
		else:
			self.response.headers['Content-Type'] = 'text/html'
			self.response.out.write(self.render_page())
Ejemplo n.º 3
0
	def get(self):
		self.response.headers['Content-Type'] = 'application/json'

		curUser = users.get_current_user()
		if not curUser:
			self.error(400)
			return
		
		userID = curUser.user_id()
		profile = profiles.get_user_profile()
		if not profile:
			self.error(400)
			return
		elif profile.currentSchedule:
			objDict = profile.currentSchedule.to_dict()
		else:
			objDict = None

		self.response.out.write(simplejson.dumps(objDict))
Ejemplo n.º 4
0
def can_access_page():
	if users.is_current_user_admin():
		return True

	# Everyone must be allowed before new users can register
	# Registering only to find that you're locked out at the moment
	# probably won't be very good.
	status = get_app_status()
	profile = profiles.get_user_profile()
	if not profile:
		# If the user does not have a profile, his ability to access
		# pages will be determined by the state of allowEveryone
		return status.allowEveryone
	
	if status.allowEveryone:
		return True
	elif profile.isPrivilegedUser and status.allowPrivilegedUsers:
		return True
		
	return False
Ejemplo n.º 5
0
	def update_user_current_schedule(self, schedule):
		profile = profiles.get_user_profile()
		profile.currentSchedule = schedule
		return profile