コンテンツへスキップ
メニュー
この質問にフラグが付けられました
5 返信
7524 ビュー

I want to identify certain machines so that no matter which user is logged in some rules will apply to them. Is it possible?

アバター
破棄
最善の回答

Hi,

You can get the logged in machine details using the following code.

import httpagentparser

agent = request.httprequest.environ.get('HTTP_USER_AGENT')
agent_details = httpagentparser.detect(agent)
user_os = agent_details['os']['name']
browser_name = agent_details['browser']['name']
ip_address = request.httprequest.environ['REMOTE_ADDR']

From the above code you will get the IP address of the logged system, Browser and OS details.

You can also check with this community modules, but it is not in v7.

https://www.odoo.com/apps/modules/10.0/login_user_detail/

https://www.odoo.com/apps/modules/10.0/user_login_alert/

Thanks

アバター
破棄
著作者

How do I get the request object?

above code is return inside the controller. You can check the modules in the given link, that will give you more info

最善の回答

User login alert gives error as "Unable to install module "user_login_alert" because an external dependency is not met: No module named httpagentparser" Please assist.

アバター
破棄

`pip install httpagentparser` should solve your issue

関連投稿 返信 ビュー 活動
2
3月 24
11376
2
8月 21
13592
1
12月 19
5419
0
9月 17
3602
0
8月 17
2912