Hello
How to limit to a single entry a registered user?
Thank you
Single entry a registered user
Re: Single entry a registered user
I'm not sure if I got your question. If you want to give a user permission to insert/edit exactly one record of a certain table only, you may consider the following alternatives:
Regards,
Jan
- Give the user's group permission to INSERT
- Give the user's group permission to UPDATE OWN records on that table
- After Insert: Remove the USER's (!) permission to insert into that table by modifying the membership_userpermissions table
- Deny INSERT for the user's group
- Allow UPDATE OWN records on that table
- after login: Check if there is a record for the logged in user already in your table (see function login_ok in hooks/_global.php).
- If not, create a record for him (using SQL) and set the ownership in table membership_userrecords (using SQL)
- Now the user will only see his one record and will be able to edit it due to the group's permission (UPDATE OWN).
- He will not be able to insert a new one due to missing group-permissions.
Regards,
Jan
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
Re: Single entry a registered user
Maybe the easiest would be, to have a field where you store the user.
This could be done by using the : Default >> Auto - username
If you then set this field a unique, then a user will only be allowed to create one entry, and if he tries to create one more, then he will see that this is not possible.
This could be done by using the : Default >> Auto - username
If you then set this field a unique, then a user will only be allowed to create one entry, and if he tries to create one more, then he will see that this is not possible.
Re: Single entry a registered user
Hello
I tried method 2 because it seemed simple but it does not work. Or I'm bad!
I tried method 2 because it seemed simple but it does not work. Or I'm bad!
- Attachments
-
- 07022019 appgini.JPG (66.43 KiB) Viewed 3114 times
Re: Single entry a registered user
Don't set it to read only, hide it in detailview and tableview.
Any help offered comes with the best of intentions. Use it at your own risk. In any case, please make a backup of your existing environment before applying any changes.
Re: Single entry a registered user
No it does not work ...
- Attachments
-
- 07022019 appgini.JPG (40.46 KiB) Viewed 3108 times
Re: Single entry a registered user
Do you have existing data?
There could be a conflict then, with more records that has the same "empty" value - and then the unique setting.
Check in the table if the field is set as unique. Maybe it is needed you manually set a value in existing records before the field can be set as unique.
There could be a conflict then, with more records that has the same "empty" value - and then the unique setting.
Check in the table if the field is set as unique. Maybe it is needed you manually set a value in existing records before the field can be set as unique.
Re: Single entry a registered user
@pasbonte: What is inside the ELEVE NOM field?
It looks like ...
...but sjohn has written...
You should try with <%%creatorUsername%%> as default value as sjohn has suggested. This should work.
Regards,
Jan
It looks like ...
Code: Select all
<!-- creatorUsename -->
Code: Select all
<%%creatorUsername%%>
Regards,
Jan
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