make_request now automatically launches a process
This commit is contained in:
parent
797d0bebb8
commit
3b35817d5b
@ -296,9 +296,9 @@ end
|
|||||||
-- ====================================
|
-- ====================================
|
||||||
-- adds a new policy to the policy table
|
-- adds a new policy to the policy table
|
||||||
-- must define the policy type, process associated with it, and whether the request must be made by an org member
|
-- must define the policy type, process associated with it, and whether the request must be made by an org member
|
||||||
function modpol.orgs:set_policy(policy_type, process, must_be_member)
|
function modpol.orgs:set_policy(policy_type, process_type, must_be_member)
|
||||||
local new_policy = {
|
local new_policy = {
|
||||||
process = process,
|
process_type = process_type,
|
||||||
must_be_member = must_be_member
|
must_be_member = must_be_member
|
||||||
}
|
}
|
||||||
self.policies[policy_type] = new_policy
|
self.policies[policy_type] = new_policy
|
||||||
|
@ -161,8 +161,12 @@ function modpol.orgs:make_request(request)
|
|||||||
end
|
end
|
||||||
request_id = count
|
request_id = count
|
||||||
end
|
end
|
||||||
modpol.ocutil.log("Request made")
|
modpol.ocutil.log("Request made by " .. request.user .. " to " .. request.type)
|
||||||
|
|
||||||
return request_id
|
-- launching process tied to this request
|
||||||
|
local process_id = self:create_process(requested_policy.process_type, request_id)
|
||||||
|
|
||||||
|
-- returns process id of processes launched by this request
|
||||||
|
return process_id
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -6,7 +6,7 @@ test_org = modpol.instance:add_org('test_org')
|
|||||||
test_org:add_member('luke')
|
test_org:add_member('luke')
|
||||||
test_org:add_member('nathan')
|
test_org:add_member('nathan')
|
||||||
|
|
||||||
test_org:set_policy("add_member", nil, false);
|
test_org:set_policy("add_member", "consent", false);
|
||||||
|
|
||||||
new_request = {
|
new_request = {
|
||||||
user = "josh",
|
user = "josh",
|
||||||
@ -16,7 +16,11 @@ new_request = {
|
|||||||
|
|
||||||
request_id = test_org:make_request(new_request)
|
request_id = test_org:make_request(new_request)
|
||||||
|
|
||||||
process_id = test_org:create_process("consent", request_id)
|
-- process_id = test_org:create_process("consent", request_id)
|
||||||
process = test_org.processes[process_id]
|
for id, process in ipairs(test_org.processes) do
|
||||||
process:approve("luke", true)
|
process:approve('luke', true)
|
||||||
process:approve("nathan", true)
|
process:approve('nathan', true)
|
||||||
|
end
|
||||||
|
-- process = test_org.processes[process_id]
|
||||||
|
-- process:approve("luke", true)
|
||||||
|
-- process:approve("nathan", true)
|
Loading…
x
Reference in New Issue
Block a user