Delayed trigger bug - Deleting records without permission; l

Posted by matman on 15-Sep-2014 02:59

Because of an earlier topic in which I was talking about some issues I had with a delayed trigger, I was fooling around a bit with delayed triggers. I set my Query API permission to the following settings:

Then I went back to add some Employee objects to my Employer object (1 - N) using Quick Create. Then, I immediately removed the Employee object using the X-icon. Which results in an orphan Employee object. Since I don't like orphan records, I added a delayed trigger with the following code:

rbv_api.log("debug", "{!name#text}'s master: {!R108244227#id}");
 
if ({!R108244227#id} < 0) {
  rbv_api.deleteRecord("medewerker", {!id});
  rbv_api.log("debug", "{!name#text} has been deleted!");
}

The trigger is set to "Run trigger on 'After Create' with a 1 minute delay". Knowing that the trigger is delayed and the Query API doesn't have the permissions to delete the Employee record, the record should stay alive.
So after creating an Employee, the trigger gets added to the queue. It was supposed to run on 9:41 AM, but when I checked back on 9:42 it was still there. Only a little later it disappeared from the queue, leaving the following in the log:

When I check back at my Employee objects view, I cannot find that record anymore. Now.. I don't know if you guys consider this a bug. It's most likely caused by cached permissions or something like that.

EDIT 1: Event log shows the following:

EDIT 2: Tested something. I set the permissions to:

And logged out using Pacific's logout. Before logging out I ran through my scenario as described above so that a delayed trigger was set to run when I was logged out (No more Administrator permissions). The trigger deleted the record and ran without any errors.

All Replies

Posted by Orchid Corpin on 15-Sep-2014 12:06

Hi matman,

I'm sorry I could not replicate the issue for running rbv_api.deleteRecord() without Query API permissions. Here is the log I found when trying to replicate it.

Attached here is test XML i created, feel free to try it out and let me know if I missed something.

Thanks,

Orchid

Posted by matman on 16-Sep-2014 04:15

Thanks for your reply Orchid. Before I'll try your application I'll talk about something I noticed.


When I remove / add all Query API permissions and run a trigger after 5 minutes, everything works fine. However, after 1 minute, nothings works the way it should. I'll try to explain this using my scenario now.

/* Current situation: Query API - No permissions at all

/* Here I set delayed triggers to 1 minute after current time */

[2014-09-15 04:49:29,023] Unloaded from WORKFLOW Server at 09/15/2014 04:49 AM
[2014-09-16 02:28:31,983] Loaded on WORKFLOW Server at 09/16/2014 02:28 AM

/* Start running a few 1 minute delayed triggers */

[2014-09-16 02:28:31,993] Query API: permission denied

/* Here I changed Query API permissions to FULL access */

[2014-09-16 02:40:20,575] Unloaded from WORKFLOW Server at 09/16/2014 02:40 AM
[2014-09-16 02:42:34,131] Loaded on WORKFLOW Server at 09/16/2014 02:42 AM

/* Start running a few 1 minute delayed triggers */

[2014-09-16 02:42:34,134] Query API: permission denied

[2014-09-16 02:48:34,701] Query API: permission denied

[2014-09-16 02:52:35,052] Query API: permission denied

[2014-09-16 03:00:37,214] Query API: permission denied

[2014-09-16 03:35:13,005] Query API: permission denied

/* Here I set delayed triggers to 5 minutes after current time */

[2014-09-16 03:43:28,908] Unloaded from WORKFLOW Server at 09/16/2014 03:43 AM
[2014-09-16 03:49:14,372] Loaded on WORKFLOW Server at 09/16/2014 03:49 AM

/* Start running a 5 minutes delayed trigger */

[2014-09-16 03:49:14,374] Running "checkOrphanity" for test 160907 (109381108)
[2014-09-16 03:49:14,411] Finished "checkOrphanity" time=42 ms

In the event log above I wrote down the step I walked through and the results that were returned after. As you can see: after changing the Query API permissions to full access, the server still returns Permission Denied for an entire hour on 1 minute delayed triggers. But here comes the funny thing: after I change the delay to 5 minutes, everthing goes OK.

Posted by Orchid Corpin on 16-Sep-2014 12:31

Hi matman,

I have tested your given scenario and was able to replicate it. I will file a defect on this.

Will keep you posted. Thank you.

Regards,

Orchid

Posted by Orchid Corpin on 24-Nov-2014 08:40
Updates: Defect has been fixed with the status Planned for 3.1.0.0 release.

Regards,
Orchid
This thread is closed