From 512ed2ecd460cb4b01a116475ae707983c7fefe1 Mon Sep 17 00:00:00 2001 From: Luke Miller Date: Fri, 20 Aug 2021 01:18:02 -0400 Subject: [PATCH] added wrapper function for process:interact to control access --- modpol/orgs/requests.lua | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/modpol/orgs/requests.lua b/modpol/orgs/requests.lua index 06d2daf..aacc085 100644 --- a/modpol/orgs/requests.lua +++ b/modpol/orgs/requests.lua @@ -255,3 +255,18 @@ function modpol.orgs:make_request(request) return process_id end +-- wrapper for process:interact function, ensures that user actually has a pending action for that process +function modpol.orgs:interact(process_id, user) + process = self.processes[process_id] + if self.pending[user] then + if self.pending[user][process_id] == true then + process:interact(user) + else + modpol.ocutil.log("Cannot interact with process, user does not have a valid pending action") + end + else + modpol.ocutil.log("Cannot interact with process, user does not have any pending actions") + end + +end +