Přejít na obsah
Menu
You need to be registered to interact with the community.
This question has been flagged
1824 Zobrazení

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
Zrušit

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.

Autor

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)

Autor

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.

Related Posts Odpovědi Zobrazení Aktivita
2
pro 23
14647
0
říj 23
33
3
říj 23
788
1
říj 23
569
1
srp 23
2405