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
- Akuntansi
- Inventaris
- PoS
- Project
- MRP
Pertanyaan ini telah diberikan tanda
2
Replies
4660
Tampilan
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! :)
Menikmati diskusi? Jangan hanya membaca, ikuti!
Buat akun sekarang untuk menikmati fitur eksklufi dan agar terlibat dengan komunitas kami!
DaftarPost Terkait | Replies | Tampilan | Aktivitas | |
---|---|---|---|---|
|
2
Sep 21
|
3365 | ||
|
0
Nov 23
|
975 | ||
|
1
Feb 21
|
4353 | ||
|
4
Jul 20
|
13371 | ||
|
0
Mar 18
|
3670 |