significant progress! a working process from beginning to end can be seen in test/org_req_test.lua
This commit is contained in:
@@ -271,7 +271,8 @@ end
|
||||
function modpol.orgs:list_member()
|
||||
local str
|
||||
for k, v in ipairs(self.members) do
|
||||
if str then
|
||||
-- checking to see if member name is valid
|
||||
if str and str ~= '' then
|
||||
str = str .. '\n' .. v
|
||||
else
|
||||
str = v
|
||||
@@ -280,6 +281,18 @@ function modpol.orgs:list_member()
|
||||
return str
|
||||
end
|
||||
|
||||
-- ==============================
|
||||
-- because member list uses lazy deletion, using #org.members will not show an accurate number
|
||||
function modpol.orgs:get_member_count()
|
||||
local count = 0
|
||||
for k, v in ipairs(self.members) do
|
||||
-- the empty string represents a deleted member in the members list
|
||||
if v ~= '' then
|
||||
count = count + 1
|
||||
end
|
||||
end
|
||||
return count
|
||||
end
|
||||
-- ====================================
|
||||
-- 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
|
||||
|
||||
@@ -67,6 +67,28 @@ function modpol.orgs:list_request()
|
||||
return str
|
||||
end
|
||||
|
||||
-- ===============================
|
||||
-- if the request was approved, the associated function is called, otherwise it is deleted
|
||||
function modpol.orgs:resolve_request(request_id, approve)
|
||||
if approve then
|
||||
local request = self.requests[request_id]
|
||||
local p = request.params
|
||||
|
||||
if request.type == "add_org" then
|
||||
self:add_org(p[1])
|
||||
elseif request.type == "delete" then
|
||||
self:delete()
|
||||
elseif request.type == "add_member" then
|
||||
self:add_member(p[1])
|
||||
elseif request.type == "remove_member" then
|
||||
self:remove_member(p[1])
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
self.requests[request_id] = "deleted"
|
||||
end
|
||||
|
||||
-- ================================
|
||||
-- tries to make a request to the org
|
||||
function modpol.orgs:make_request(request)
|
||||
|
||||
Reference in New Issue
Block a user