当前位置: 首页>>代码示例>>Python>>正文


Python APIPermissions.add_user方法代码示例

本文整理汇总了Python中API.APIPermissions.add_user方法的典型用法代码示例。如果您正苦于以下问题:Python APIPermissions.add_user方法的具体用法?Python APIPermissions.add_user怎么用?Python APIPermissions.add_user使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在API.APIPermissions的用法示例。


在下文中一共展示了APIPermissions.add_user方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_user_remove_user_by_id_succeed

# 需要导入模块: from API import APIPermissions [as 别名]
# 或者: from API.APIPermissions import add_user [as 别名]
	def test_user_remove_user_by_id_succeed(self):
		usr = User('[email protected]')
		usr.set_nickname('Somebodyruis')
		usr.set_user_id('SomeUserid1234ruis')
		ps.add_user(usr)

		self.assertTrue(ps.remove_user_by_id('SomeUserid1234ruis'))
开发者ID:Keesaco,项目名称:KeesaFlo,代码行数:9,代码来源:TestAPIPermissions.py

示例2: test_user_get_user_by_id_succeed

# 需要导入模块: from API import APIPermissions [as 别名]
# 或者: from API.APIPermissions import add_user [as 别名]
	def test_user_get_user_by_id_succeed(self):
		usr = User('[email protected]')
		usr.set_nickname('Somebodyguis')
		usr.set_user_id('SomeUserid1234guis')
		ps.add_user(usr)

		self.assertEqual(ps.get_user_by_id('SomeUserid1234guis').email(), usr.email())
开发者ID:Keesaco,项目名称:KeesaFlo,代码行数:9,代码来源:TestAPIPermissions.py

示例3: test_user_modify_user_by_id_succeed

# 需要导入模块: from API import APIPermissions [as 别名]
# 或者: from API.APIPermissions import add_user [as 别名]
	def test_user_modify_user_by_id_succeed(self):
		usr = User('[email protected]')
		usr.set_nickname('Somebodymids')
		usr.set_user_id('SomeUserid1234mids')
		ps.add_user(usr)

		newusr = User('[email protected]')
		newusr.set_nickname('SomebodyElsemids')
		newusr.set_user_id('SomeUotherId3878mids')
		key = ps.modify_user_by_id('SomeUserid1234mids',newusr)

		self.assertEqual(ps.get_user_by_key(key).email(), newusr.email())
开发者ID:Keesaco,项目名称:KeesaFlo,代码行数:14,代码来源:TestAPIPermissions.py

示例4: test_user_add_user

# 需要导入模块: from API import APIPermissions [as 别名]
# 或者: from API.APIPermissions import add_user [as 别名]
	def test_user_add_user(self):
		usr = User('[email protected]')
		usr.set_nickname('Somebodyau')
		usr.set_user_id('SomeUserid1234au')
		ret = ps.add_user(usr)

		self.assertTrue(isinstance(ret, ndb.Key))
开发者ID:Keesaco,项目名称:KeesaFlo,代码行数:9,代码来源:TestAPIPermissions.py

示例5: test_user_get_user_key_by_id

# 需要导入模块: from API import APIPermissions [as 别名]
# 或者: from API.APIPermissions import add_user [as 别名]
	def test_user_get_user_key_by_id(self):
		usr = User('[email protected]')
		usr.set_nickname('Somebodyguki')
		usr.set_user_id('SomeUserid1234guki')
		key = ps.add_user(usr)

		self.assertEqual(key,ps.get_user_key_by_id("SomeUserid1234guki"))
开发者ID:Keesaco,项目名称:KeesaFlo,代码行数:9,代码来源:TestAPIPermissions.py

示例6: signup_handler

# 需要导入模块: from API import APIPermissions [as 别名]
# 或者: from API.APIPermissions import add_user [as 别名]
def signup_handler(request):
	authed_user = auth.get_current_user()
	if authed_user is None:
		return __unauthed_response()

	user_key = ps.get_user_key_by_id(authed_user.user_id())
	if user_key is None:
		user_key = ps.add_user(authed_user)

	response_part = {
		'success'		: False
	}

	try:
		file_req = json.loads(request.raw_post_data)
	except ValueError:
		response_part.update({'error' : 'Invalid request payload.'})
		return HttpResponse(json.dumps(response_part), content_type="application/json")
		
	if 'action' not in file_req:
		response_part.update({'error' : 'Incomplete request.'})
		return HttpResponse(json.dumps(response_part), content_type="application/json")

	elem_key = ps.get_element_key_by_ref('canLogIn')
	if elem_key is None:
		elem_key = ps.add_element('canLogIn')

	user_elem = ps.get_user_element_permissions(user_key, elem_key)
	if user_elem is not None:
		response_part.update({'error' : 'Already signed up.'})
		return HttpResponse(json.dumps(response_part), content_type="application/json")
	else:
		ps.add_element_permissions(user_key, elem_key, True)

		response_part.update({'success' : True})
		return HttpResponse(json.dumps(response_part), content_type="application/json")
开发者ID:Keesaco,项目名称:KeesaFlo,代码行数:38,代码来源:views.py


注:本文中的API.APIPermissions.add_user方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。