summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTed Trask <ttrask01@yahoo.com>2011-06-27 14:47:01 +0000
committerTed Trask <ttrask01@yahoo.com>2011-06-27 14:47:01 +0000
commit7845c088985ad2d7857f3f1c9d9f24846b844798 (patch)
treeddc4c08160ff7c9ecd4ffb8caa5b24c33d95dd6f
parent8d10e0cd470098e7dd5e63ce535ab12c328182f4 (diff)
downloadacf-core-7845c088985ad2d7857f3f1c9d9f24846b844798.tar.bz2
acf-core-7845c088985ad2d7857f3f1c9d9f24846b844798.tar.xz
Removed duplicates from determine_perms arrays
-rw-r--r--lib/roles.lua16
1 files changed, 11 insertions, 5 deletions
diff --git a/lib/roles.lua b/lib/roles.lua
index c2f54a3..7c69724 100644
--- a/lib/roles.lua
+++ b/lib/roles.lua
@@ -231,9 +231,13 @@ local determine_perms = function(self,roles)
permissions[prefix][control] = {}
end
if action then
- permissions[prefix][control][action] = {file}
- permissions_array[#permissions_array + 1] = prefix .. control .. "/" .. action
- default_permissions_array[#default_permissions_array + 1] = prefix .. control .. "/" .. action
+ if not permissions[prefix][control][action] then
+ permissions[prefix][control][action] = {file}
+ permissions_array[#permissions_array + 1] = prefix .. control .. "/" .. action
+ default_permissions_array[#default_permissions_array + 1] = prefix .. control .. "/" .. action
+ else
+ permissions[prefix][control][action][#permissions[prefix][control][action] + 1] = file
+ end
end
end
end
@@ -256,8 +260,10 @@ local determine_perms = function(self,roles)
if nil == permissions[prefix][control] then
permissions[prefix][control] = {}
end
- permissions[prefix][control][action] = {}
- permissions_array[#permissions_array + 1] = prefix .. control .. "/" .. action
+ if nil == permissions[prefix][control][action] then
+ permissions[prefix][control][action] = {}
+ permissions_array[#permissions_array + 1] = prefix .. control .. "/" .. action
+ end
end
end
end