Hello fellas here is my question:
Is possible to restrict access to given http route by res.groups.
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- CRM
- e-Commerce
- Kế toán
- Tồn kho
- PoS
- Project
- MRP
Câu hỏi này đã bị gắn cờ
2
Trả lời
4658
Lượt xem
Hi,
Inside the route you can check whether user belongs to some group or not. Based on this checking you can perform your operations,
See a sample,
@http.route(['/test/page'], type='http', csrf=False, auth="user", website=True)
def redirect_test_page(self, **kwargs):
user_rec = request.env['res.users'].sudo().search([('id', '=', request.session.uid)])
if user_rec.has_group('group_external_id'):
# write the code if user belongs to group
return request.render('template_id')
else:
# code here if user not in group
return request.render('template_id')
Hope this will give you some idea.
Thanks
Thank you this is what i needed! :)
Bạn có hứng thú với cuộc thảo luận không? Đừng chỉ đọc, hãy tham gia nhé!
Tạo tài khoản ngay hôm nay để tận hưởng các tính năng độc đáo và tham gia cộng đồng tuyệt vời của chúng tôi!
Đăng kýBài viết liên quan | Trả lời | Lượt xem | Hoạt động | |
---|---|---|---|---|
|
2
thg 9 21
|
3364 | ||
|
0
thg 11 23
|
974 | ||
|
1
thg 2 21
|
4353 | ||
|
4
thg 7 20
|
13371 | ||
|
0
thg 3 18
|
3670 |