Hello CSPro team,
I would like to refer you to the implications of including in the ID items an Auto Increment and Protected field as well as the user login (alpha and Protected) already validated and retrieved during Menu execution.
Would including these fields ensure that adding cases never have the same ID?
How to ensure that only the user who added a case modifies or deletes that case?
Thank you very much in advance
Use of Auto Increment and Protected fields and user login in ID
-
- Posts: 29
- Joined: October 5th, 2019, 1:43 pm
-
- Posts: 1812
- Joined: December 5th, 2011, 11:27 pm
- Location: Washington, DC
Re: Use of Auto Increment and Protected fields and user login in ID
Without knowing how the logic is generated, it's not possible to guarantee that the IDs are unique. For example, if someone could log in to two difference devices with the same login, then you'd still get duplicates because the auto increment would start at 1 on each device.
If you can guarantee that enumerators will not change devices while conducting fieldwork, you could prevent alternative users from modifying cases using logic. For example, you could store the device ID in the data in a protected field:
If you can guarantee that enumerators will not change devices while conducting fieldwork, you could prevent alternative users from modifying cases using logic. For example, you could store the device ID in the data in a protected field:
PROC DEVICE_ID
preproc
// prefill in the device ID when we're adding data
if DEVICE_ID = "" then
DEVICE_ID = getdeviceid();
// otherwise prevent modification on devices other than the initial one
elseif DEVICE_ID <> getdeviceid() then
errmsg("You cannot modify this case!");
stop(0);
endif;
Preventing deletions is harder because you cannot run logic on the Case Listing screen. What you can do is prevent deletions on that screen (Lock=Delete in the PFF) and then have a delete option in your menu program that controls who can delete what cases.preproc
// prefill in the device ID when we're adding data
if DEVICE_ID = "" then
DEVICE_ID = getdeviceid();
// otherwise prevent modification on devices other than the initial one
elseif DEVICE_ID <> getdeviceid() then
errmsg("You cannot modify this case!");
stop(0);
endif;
-
- Posts: 29
- Joined: October 5th, 2019, 1:43 pm
Re: Use of Auto Increment and Protected fields and user login in ID
Hi Gregory,
Thanks for the directions!
Thanks for the directions!