Merge branch 'master' into modules
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
modpol.orgs =
|
||||
modpol.orgs = modpol.orgs or
|
||||
{
|
||||
count = 1,
|
||||
array = {}
|
||||
@@ -82,6 +82,8 @@ function modpol.orgs.reset()
|
||||
modpol.orgs.array[id] = nil
|
||||
end
|
||||
end
|
||||
|
||||
modpol.orgs:record('Resetting all orgs', 'org_reset')
|
||||
end
|
||||
|
||||
-- ===================================================
|
||||
@@ -103,6 +105,9 @@ function modpol.orgs.init_instance()
|
||||
|
||||
-- adding instance to org list
|
||||
modpol.orgs.array[1] = instance
|
||||
|
||||
modpol.orgs:record('Initialized the instance org', 'create_instance')
|
||||
|
||||
return instance
|
||||
end
|
||||
|
||||
@@ -158,6 +163,12 @@ function modpol.orgs:add_org(name)
|
||||
return false, error_msg
|
||||
end
|
||||
|
||||
if modpol.orgs.get_org(name) then
|
||||
error_msg = 'Error: org name is already being used'
|
||||
modpol.ocutil.log(error_msg)
|
||||
return false, error_msg
|
||||
end
|
||||
|
||||
-- creating the child sub org
|
||||
modpol.orgs.count = modpol.orgs.count + 1
|
||||
local child_org = temp_org()
|
||||
@@ -173,6 +184,7 @@ function modpol.orgs:add_org(name)
|
||||
-- adding child to org list
|
||||
modpol.orgs.array[child_org.id] = child_org
|
||||
|
||||
self:record('created sub org ' .. name, 'add_org')
|
||||
|
||||
return child_org
|
||||
end
|
||||
@@ -197,6 +209,8 @@ function modpol.orgs:delete()
|
||||
modpol.orgs.array[self.id] = 'removed'
|
||||
print('Removed ' .. self.name .. ': ' .. self.id)
|
||||
|
||||
self:record('Deleted ' .. self.name .. ' and all child orgs', 'del_org')
|
||||
|
||||
end
|
||||
|
||||
|
||||
@@ -221,6 +235,7 @@ function modpol.orgs:add_member(user)
|
||||
-- adds to end if no empty spots
|
||||
table.insert(self.members, user)
|
||||
end
|
||||
self.record('Added member ' .. user, 'add_member')
|
||||
end
|
||||
|
||||
-- =======================================
|
||||
@@ -232,6 +247,7 @@ function modpol.orgs:remove_member(user)
|
||||
if user_index then
|
||||
self.members[user_index] = ''
|
||||
end
|
||||
self.record('Removed member ' .. user, 'del_member')
|
||||
end
|
||||
|
||||
-- ===========================================
|
||||
|
||||
Reference in New Issue
Block a user