diff options
author | Ted Trask <ttrask01@yahoo.com> | 2008-05-01 20:49:59 +0000 |
---|---|---|
committer | Ted Trask <ttrask01@yahoo.com> | 2008-05-01 20:49:59 +0000 |
commit | fbda79f377ffbad71b38d2ddf273913dc95ab177 (patch) | |
tree | cac8faf1dc9d33aa5044140b32f0eba8d2cea3b2 /lib/roles.lua | |
parent | 21b0abee37316cd578a984c3de0ec878a8b41f72 (diff) | |
download | acf-core-fbda79f377ffbad71b38d2ddf273913dc95ab177.tar.bz2 acf-core-fbda79f377ffbad71b38d2ddf273913dc95ab177.tar.xz |
Modified roles, logon, and authenticator
git-svn-id: svn://svn.alpinelinux.org/acf/core/trunk@1095 ab2d0c66-481e-0410-8bed-d214d4d58bed
Diffstat (limited to 'lib/roles.lua')
-rw-r--r-- | lib/roles.lua | 33 |
1 files changed, 32 insertions, 1 deletions
diff --git a/lib/roles.lua b/lib/roles.lua index 806be67..768e96f 100644 --- a/lib/roles.lua +++ b/lib/roles.lua @@ -48,7 +48,7 @@ get_controllers_func = function(self,controller_info) temp1 = {} for a,b in pairs(temp) do local c = string.match(a,"mvc") or string.match(a,"^_") - if c == nil then + if c == nil and type(temp[a])=="function" then temp1[#temp1 +1] = a end end @@ -106,3 +106,34 @@ get_roles_perm = function(startdir,roles) return permissions end +-- Go through the roles files and determine the permissions for the specified role +get_role_perm = function(startdir,role) + permissions = {} + + -- find all of the roles files and add in the master file + local rolesfiles = get_roles_candidates(startdir) + rolesfiles[#rolesfiles + 1] = "/etc/acf/roles" + + for x,file in ipairs(rolesfiles) do + f = fs.read_file_as_array(file) + for y,line in pairs(f) do + if role == string.match(line,"^[%a]+") then + temp = format.string_to_table(string.match(line,"[,%a:]+$"),",") + for z,perm in pairs(temp) do + local control,action = string.match(perm,"(%a+):(%a+)") + if control then + if nil == permissions[control] then + permissions[control] = {} + end + if action and nil == permissions[control][action] then + permissions[control][action] = {} + end + end + end + end + end + end + + return permissions +end + |