odoo_dev 开发培训作业:图书管理系统
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

17 lines
594B

  1. from xmlrpc import client
  2. server_url = 'http://localhost:9999'
  3. db_name = 'library_13'
  4. username = 'user2'
  5. password = '098iop'
  6. common = client.ServerProxy('%s/xmlrpc/2/common' % server_url)
  7. user_id = common.authenticate(db_name, username, password, {})
  8. models = client.ServerProxy('%s/xmlrpc/2/object' % server_url)
  9. if user_id:
  10. has_access = models.execute_kw(db_name, user_id, password, 'library.book', 'check_access_rights',
  11. ['create'], {'raise_exception': False})
  12. print('Has create access on book:', has_access)
  13. else:
  14. print('Wrong credentials')
上海开阖软件有限公司 沪ICP备12045867号-1