İçereği Atla
Menü
Bu soru işaretlendi
1825 Görünümler

I made a user group that have access to a read and create operation on a Users model. But when user with that group is trying to create new user there is an error that he does not have access to write operation. 

https://i.imgur.com/fDGiJdf.png

Why when I'm creating something there is also necessary to have write privelage?

Access rights:

https://i.imgur.com/5iLhKeI.png

Record rules:

https://i.imgur.com/rky9y70.png

Avatar
Vazgeç

If the user can create, then you give him write access as well. Because when you create a record, the write method is called too. You can check this by adding a print to write and try then to create a record.

Üretici

But why write is called too? What is the point to have crate and write access splited up in that case? I want users only to create new ones and not to edit existing ones (because then they can change admin passowrd).

You could hide the admin user from the other users, overriding the search method of res.users, you can use self.env.user.id == SUPERUSER_ID then append to the domain ('id' ,'!=', self.env.user.id).

But you should verify your logic, if you create an user, you should be able to edit that user.

Sorry, the condition is if self.env.user.id != SUPERUSER_ID then append to the domain('id', '!=', SUPERUSER_ID)

Üretici

But where do I put this?

And I need to protect not only one superuser but also other users with high privileges. I simply don't want users to edit others with the same or higher privileges. And the simples solution would be to deny write access but odoo is broken and calls it when it shoudn't.

İlgili Gönderiler Cevaplar Görünümler Aktivite
2
Ara 23
14648
0
Eki 23
33
3
Eki 23
788
1
Eki 23
569
1
Ağu 23
2405