summaryrefslogtreecommitdiffstats
path: root/lib/roles.lua
diff options
context:
space:
mode:
authorMike Mason <ms13sp@gmail.com>2008-02-04 21:07:39 +0000
committerMike Mason <ms13sp@gmail.com>2008-02-04 21:07:39 +0000
commit3857fee1017e8dec164faa13a0ca01828b4d50f6 (patch)
tree6c5ca2101122aeaf61e18c865d4fa91eaa902a71 /lib/roles.lua
parent30e76e234af48b3c42e1e22eae2ebb25dd3625f6 (diff)
downloadacf-core-3857fee1017e8dec164faa13a0ca01828b4d50f6.tar.bz2
acf-core-3857fee1017e8dec164faa13a0ca01828b4d50f6.tar.xz
Adding the beingings of the authorization items. Also adding some of the updates to the Autentication.
git-svn-id: svn://svn.alpinelinux.org/acf/core/trunk@689 ab2d0c66-481e-0410-8bed-d214d4d58bed
Diffstat (limited to 'lib/roles.lua')
-rw-r--r--lib/roles.lua57
1 files changed, 57 insertions, 0 deletions
diff --git a/lib/roles.lua b/lib/roles.lua
new file mode 100644
index 0000000..808aa95
--- /dev/null
+++ b/lib/roles.lua
@@ -0,0 +1,57 @@
+--this module is for authorization help and group/role management
+
+
+require ("posix")
+require ("format")
+
+module (..., package.seeall)
+
+list_controllers = function(self)
+local list = {}
+local f = io.popen("/usr/bin/find /usr/share/acf/ |/bin/grep \"controller.lua$\" ")
+ for a in f:lines() do
+ list[#list + 1 ] = a
+ end
+f:close()
+return list
+end
+
+get_controllers = function(self,controller)
+ --we get all the controllers
+ local list = roles.list_controllers()
+ --we need to grab the directory and name of file
+ local temp = {}
+ for k,v in pairs(list) do
+ path = string.match(v,"[/%w-]+/")
+ filename = string.match(v,"[^/]*.lua")
+ name = string.match(filename,"[^.]*")
+ sname = string.match(filename,"[^-]*")
+ temp[sname] = {path=path,filename=filename,name=name,sname=sname}
+ end
+ if controller then
+ return temp[controller]
+ else
+ return temp
+ end
+
+end
+
+get_controllers_func = function(self,controller_info)
+ if controller_info == nil then
+ return "Could not be processed"
+ else
+ package.path=package.path .. ";" .. controller_info.path .. "?.lua"
+ temp = require (controller_info.name)
+ temp1 = {}
+ for a,b in pairs(temp) do
+ local c = string.match(a,"mvc") or string.match(a,"^_")
+ if c == nil then
+ temp1[#temp1 +1] = a
+ end
+end
+ --require (controller_info.name)
+ --we need to go through bobo and take out the mvc func and locals and --
+ return temp1
+ end
+end
+