Hello everyone!
I would need to Allow a non-admin group to change the owner of a record
Can someone help me?
Thanks!
Fabiano
Allow a non-admin group to change the owner of a record
Re: Allow a non-admin group to change the owner of a record
Php: set_record_owner function can be used or sql command on membership_userrecords table
Kind regards,
<js />
My AppGini Blog:
https://appgini.bizzworxx.de/blog
You can help us helping you:
Please always put code fragments inside
AppGini 24.10 Revision 1579 + all AppGini Helper tools
<js />
My AppGini Blog:
https://appgini.bizzworxx.de/blog
You can help us helping you:
Please always put code fragments inside
[code]...[/code]
blocks for better readabilityAppGini 24.10 Revision 1579 + all AppGini Helper tools
- aarlauskas
- Veteran Member
- Posts: 127
- Joined: 2019-04-28 18:03
- Location: Medway, UK
Re: Allow a non-admin group to change the owner of a record
I have created another field in detail view (lookup) where I then added user names in there. Then you can add a code (set_record_owner) in hooks/before_update, then basically on that new field you select a name of whoever you want to assign the record to and save the record.
Re: Allow a non-admin group to change the owner of a record
Many thanks jsetzer and aarlauskas!
Can you help me with the code and more specific advice on how to deal with these conditions in my "booking" table
1) users belonging to the "clients" group cannot change the owner of a record so they should not see the lookup field with the list of owners but this restriction should not be managed with javascript because it could be sabotaged by an expert user
2) users belonging to the "managers" group should be able to see and modify the owner of the records.
I thought the problem could be solved by using multiple solutions at the same time:
a) create a "userlist" table with user names and authorize only the "managers" group to view the contents of that table
b) create, as suggested by aarlauskas, an "owner" lookup field in the booking table and set the "inherit access permissions" option in appgini.
c) set the privileges of the clients group to see only their own records and prevent them from updating their records (point "b" should prevent clients from seeing the list of other users and point "c" should prevent clients to try to change the user owner of the record).
d) even if it is not sure, but above all for "aesthetic" reasons, create a script that makes the "owner" field "hidden" and "readonly" to those who do not belong to the "admins" and "managers" groups.
So I ask you who are more experienced: do you think this hypothesis works?
Can you help me with the code?
The first hurdle for me is: how can I list the users in a lookup field of a new table?
Thank you very much for helping!
Fabiano
Can you help me with the code and more specific advice on how to deal with these conditions in my "booking" table
1) users belonging to the "clients" group cannot change the owner of a record so they should not see the lookup field with the list of owners but this restriction should not be managed with javascript because it could be sabotaged by an expert user
2) users belonging to the "managers" group should be able to see and modify the owner of the records.
I thought the problem could be solved by using multiple solutions at the same time:
a) create a "userlist" table with user names and authorize only the "managers" group to view the contents of that table
b) create, as suggested by aarlauskas, an "owner" lookup field in the booking table and set the "inherit access permissions" option in appgini.
c) set the privileges of the clients group to see only their own records and prevent them from updating their records (point "b" should prevent clients from seeing the list of other users and point "c" should prevent clients to try to change the user owner of the record).
d) even if it is not sure, but above all for "aesthetic" reasons, create a script that makes the "owner" field "hidden" and "readonly" to those who do not belong to the "admins" and "managers" groups.
So I ask you who are more experienced: do you think this hypothesis works?
Can you help me with the code?
The first hurdle for me is: how can I list the users in a lookup field of a new table?
Thank you very much for helping!
Fabiano