Exemple #1
0
def create_user(session):
	from columns.model import User
	from columns.config.authorization import INV_PERMISSIONS
	item = User()
	item.type = INV_PERMISSIONS['subscriber']
	if session.get('auth_type',None) == 'facebook':
		item.fb_id = session['auth_oid']
	elif session.get('auth_type',None) == 'twitter':
		item.twitter_id = session['auth_oid']
	else: #session.get('auth_type',None) == 'openid':
		item.open_id = session['auth_oid']
	item.save()
	return item
Exemple #2
0
	def create(self):
		"""POST /accounts: Create a new item"""
		# url('accounts')
		from columns.config.authorization import INV_PERMISSIONS
		item = User()
		item.name = request.POST.get('name',None)
		item.profile = request.POST.get('profile',None)
		item.type = INV_PERMISSIONS['subscriber']
		if session.get('auth_type',None) == 'facebook':
			item.fb_id = session['oid']
		elif session.get('auth_type',None) == 'twitter':
			item.twitter_id = session['oid']
		elif session.get('auth_type',None) == 'openid':
			item.open_id = session['oid']
		session['user_name'] = item.name
		session['user_type'] = item.type
		session['user_profile'] = item.profile
		session.save()
		item.save(session, app_globals)
		redirect(url("main"))