Passa al contenuto
Menu
È necessario essere registrati per interagire con la community.
La domanda è stata contrassegnata
5 Risposte
7518 Visualizzazioni

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

Avatar
Abbandona
Risposta migliore

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

Avatar
Abbandona
Autore

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

Risposta migliore

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.

Avatar
Abbandona

`pip install httpagentparser` should solve your issue

Post correlati Risposte Visualizzazioni Attività
2
mar 24
11359
2
ago 21
13569
1
dic 19
5409
0
set 17
3579
0
ago 17
2908