我已经在pythoneve中实现了我的web服务。我有几个端点,比如人,地址等。在
端点架构定义如下:
RESOURCE_METHODS = ['GET', 'POST', 'DELETE']
ITEM_METHODS = ['GET', 'PATCH', 'PUT', 'DELETE']
people = {
'item_title': 'person',
'cache_control': 'max-age=10,must-revalidate',
'cache_expires': 10,
'resource_methods': ['GET', 'POST'],
'schema': dbtableSchema.schema_people,
'public_methods': ['POST']
}
org = {
'item_title': 'org',
'cache_control': 'max-age=10,must-revalidate',
'cache_expires': 10,
'resource_methods': ['GET', 'POST'],
'schema': dbtableSchema.schema_people_org
}
puburl = {
'item_title': 'puburl',
'cache_control': 'max-age=10,must-revalidate',
'cache_expires': 10,
'resource_methods': ['GET', 'POST'],
'schema': dbtableSchema.schema_people_pub_url
}
address = {
'item_title': 'address',
'cache_control': 'max-age=10,must-revalidate',
'cache_expires': 10,
'resource_methods': ['GET', 'POST'],
'schema': dbtableSchema.schema_people_address
}
contactnumber = {
'item_title': 'contactnumber',
'cache_control': 'max-age=10,must-revalidate',
'cache_expires': 10,
'resource_methods': ['GET', 'POST'],
'schema': dbtableSchema.schema_people_contact_number
}
template = {
'item_title': 'template',
'cache_control': 'max-age=10,must-revalidate',
'cache_expires': 10,
'resource_methods': ['GET', 'POST'],
'schema': dbtableSchema.schema_template
}
usersharedcontacts = {
'item_title': 'usersharedcontacts',
'cache_control': 'max-age=10,must-revalidate',
'cache_expires': 10,
'resource_methods': ['GET', 'POST'],
'schema': dbtableSchema.schema_people_with_user_shared_contacts
}
cardholder = {
'item_title': 'cardholder',
'cache_control': 'max-age=10,must-revalidate',
'cache_expires': 10,
'resource_methods': ['GET', 'POST'],
'schema': dbtableSchema.schema_people_card_holder
}
DOMAIN = {
'people': people,
'org': org,
'puburl': puburl,
'address': address,
'contactnumber': contactnumber,
'template': template,
'usersharedcontacts': usersharedcontacts,
'cardholder': cardholder
}
我实现了身份验证,以使对people
端点的POST
调用是免费的,也就是说,可以在不需要任何身份验证的情况下创建用户配置文件,并填充数据库中的people
表。在
我现在要确保一旦一个用户通过身份验证,他/她就不能修改其他用户的信息。有没有办法在Python EVE
中处理这个问题。在
[EDIT]:- There was some bug in my code , @Niccola's Solution worked properly ..
您可能需要使用User Restricted Resource Access功能。引用文件:
相关问题 更多 >
编程相关推荐