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


Python APIPermissions.add_element_permissions方法代码示例

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


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

示例1: test_e_permissions_get_user_element_permissions

# 需要导入模块: from API import APIPermissions [as 别名]
# 或者: from API.APIPermissions import add_element_permissions [as 别名]
	def test_e_permissions_get_user_element_permissions(self):
		user_key = ndb.Key("uk","guep")
		element_key = ndb.Key("ek","guep")
		ps.add_element_permissions(user_key,element_key,True)

		obj = ps.get_user_element_permissions(user_key,element_key)

		self.assertEqual(obj.user_key, user_key)
		self.assertEqual(obj.element_key, element_key)
		self.assertEqual(obj.access, True)
开发者ID:Keesaco,项目名称:KeesaFlo,代码行数:12,代码来源:TestAPIPermissions.py

示例2: test_e_permissions_modify_user_element_permissions

# 需要导入模块: from API import APIPermissions [as 别名]
# 或者: from API.APIPermissions import add_element_permissions [as 别名]
	def test_e_permissions_modify_user_element_permissions(self):
		key = ps.add_element_permissions(ndb.Key("uk","muep"),ndb.Key("ek","muep"),True)

		ps.modify_user_element_permissions(ndb.Key("uk","muep"),ndb.Key("ek","muep"), False)
		retrieved = ps.get_element_permissions_by_key(key)

		self.assertFalse(retrieved.access)
开发者ID:Keesaco,项目名称:KeesaFlo,代码行数:9,代码来源:TestAPIPermissions.py

示例3: test_e_permissions_revoke_element_permissions_user_key

# 需要导入模块: from API import APIPermissions [as 别名]
# 或者: from API.APIPermissions import add_element_permissions [as 别名]
	def test_e_permissions_revoke_element_permissions_user_key(self):
		uk = ndb.Key("uk","repuk")
		ps.add_element_permissions(uk,ndb.Key("ek","repuk1"),True)
		ps.add_element_permissions(uk,ndb.Key("ek","repuk1"),True)
		ps.add_element_permissions(uk,ndb.Key("ek","repuk1"),True)

		ps.revoke_element_permissions_user_key(uk)
		with self.assertRaises(StopIteration):
			ps.get_element_permissions_by_user_key(uk).next()
开发者ID:Keesaco,项目名称:KeesaFlo,代码行数:11,代码来源:TestAPIPermissions.py

示例4: test_e_permissions_revoke_element_permissions_element_key

# 需要导入模块: from API import APIPermissions [as 别名]
# 或者: from API.APIPermissions import add_element_permissions [as 别名]
	def test_e_permissions_revoke_element_permissions_element_key(self):
		ek = ndb.Key("ek","repek")
		ps.add_element_permissions(ndb.Key("uk","repek1"),ek,True)
		ps.add_element_permissions(ndb.Key("uk","repek2"),ek,True)
		ps.add_element_permissions(ndb.Key("uk","repek3"),ek,True)

		ps.revoke_element_permissions_element_key(ek)
		with self.assertRaises(StopIteration):
			ps.get_element_permissions_by_element_key(ek).next()
开发者ID:Keesaco,项目名称:KeesaFlo,代码行数:11,代码来源:TestAPIPermissions.py

示例5: signup_handler

# 需要导入模块: from API import APIPermissions [as 别名]
# 或者: from API.APIPermissions import add_element_permissions [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

示例6: test_e_permissions_get_element_permissions_by_user_key

# 需要导入模块: from API import APIPermissions [as 别名]
# 或者: from API.APIPermissions import add_element_permissions [as 别名]
	def test_e_permissions_get_element_permissions_by_user_key(self):
		uk = ndb.Key("uk","gepuk")
		ps.add_element_permissions(uk,ndb.Key("ek","gepuk1"),True)
		ps.add_element_permissions(uk,ndb.Key("ek","gepuk2"),True)
		ps.add_element_permissions(uk,ndb.Key("ek","gepuk3"),True)

		elements = ps.get_element_permissions_by_user_key(uk)

		for element in elements:
			self.assertEqual(element.user_key, uk)
开发者ID:Keesaco,项目名称:KeesaFlo,代码行数:12,代码来源:TestAPIPermissions.py

示例7: test_e_permissions_get_element_permissions_by_element_key

# 需要导入模块: from API import APIPermissions [as 别名]
# 或者: from API.APIPermissions import add_element_permissions [as 别名]
	def test_e_permissions_get_element_permissions_by_element_key(self):
		ek = ndb.Key("ek","gepek")
		ps.add_element_permissions(ndb.Key("uk","gepek1"),ek,True)
		ps.add_element_permissions(ndb.Key("uk","gepek2"),ek,True)
		ps.add_element_permissions(ndb.Key("uk","gepek3"),ek,True)

		elements = ps.get_element_permissions_by_element_key(ek)

		for element in elements:
			self.assertEqual(element.element_key, ek)
开发者ID:Keesaco,项目名称:KeesaFlo,代码行数:12,代码来源:TestAPIPermissions.py

示例8: test_e_permissions_get_user_element_permissions_key

# 需要导入模块: from API import APIPermissions [as 别名]
# 或者: from API.APIPermissions import add_element_permissions [as 别名]
	def test_e_permissions_get_user_element_permissions_key(self):
		user_key = ndb.Key("uk","guepk")
		element_key = ndb.Key("ek","guepk")
		key = ps.add_element_permissions(user_key,element_key,True)
		self.assertEqual(key,ps.get_user_element_permissions_key(user_key,element_key))
开发者ID:Keesaco,项目名称:KeesaFlo,代码行数:7,代码来源:TestAPIPermissions.py

示例9: test_e_permissions_revoke_element_permissions_by_key

# 需要导入模块: from API import APIPermissions [as 别名]
# 或者: from API.APIPermissions import add_element_permissions [as 别名]
	def test_e_permissions_revoke_element_permissions_by_key(self):
		key = ps.add_element_permissions(ndb.Key("uk","repk"),ndb.Key("ek","repk"),True)
		ps.revoke_element_permissions_by_key(key)
		self.assertIsNone(ps.get_element_permissions_by_key(key))
开发者ID:Keesaco,项目名称:KeesaFlo,代码行数:6,代码来源:TestAPIPermissions.py

示例10: test_e_permissions_revoke_user_element_permissions

# 需要导入模块: from API import APIPermissions [as 别名]
# 或者: from API.APIPermissions import add_element_permissions [as 别名]
	def test_e_permissions_revoke_user_element_permissions(self):
		user_key = ndb.Key("uk","ruep")
		element_key = ndb.Key("ek","ruep")
		ps.add_element_permissions(user_key,element_key,True)
		ps.revoke_user_element_permissions(user_key,element_key)
		self.assertIsNone(ps.get_user_element_permissions(user_key,element_key))
开发者ID:Keesaco,项目名称:KeesaFlo,代码行数:8,代码来源:TestAPIPermissions.py

示例11: test_e_permissions_add_element_permissions

# 需要导入模块: from API import APIPermissions [as 别名]
# 或者: from API.APIPermissions import add_element_permissions [as 别名]
	def test_e_permissions_add_element_permissions(self):
		ret = ps.add_element_permissions(ndb.Key("uk","aep"),ndb.Key("ek","aep"),True)

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


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