diff options
author | Mika Havela <mika.havela@gmail.com> | 2008-02-27 17:58:55 +0000 |
---|---|---|
committer | Mika Havela <mika.havela@gmail.com> | 2008-02-27 17:58:55 +0000 |
commit | f9d5de8c461cbea9c9e5310ead925f36faf30c90 (patch) | |
tree | e1c8ae98db5454db78cb49785dec4dac6f6d0319 /app/acf-util/password-model.lua | |
parent | 224d94b3d5a532265ceea2bc0be3bf0b38f1e981 (diff) | |
download | acf-core-f9d5de8c461cbea9c9e5310ead925f36faf30c90.tar.bz2 acf-core-f9d5de8c461cbea9c9e5310ead925f36faf30c90.tar.xz |
Removed password-model because it's not used.
git-svn-id: svn://svn.alpinelinux.org/acf/core/trunk@779 ab2d0c66-481e-0410-8bed-d214d4d58bed
Diffstat (limited to 'app/acf-util/password-model.lua')
-rwxr-xr-x | app/acf-util/password-model.lua | 109 |
1 files changed, 0 insertions, 109 deletions
diff --git a/app/acf-util/password-model.lua b/app/acf-util/password-model.lua deleted file mode 100755 index e2e4293..0000000 --- a/app/acf-util/password-model.lua +++ /dev/null @@ -1,109 +0,0 @@ -module(..., package.seeall) - -local configfile = "/etc/acf/passwd" - --- ################################################################################ --- LOCAL FUNCTIONS - -local function get_roles() - local output = cfe({ - name="roles", - label="Available roles", - type="checkbox", - option={"CREATE","UPDATE","DELETE","READ"}, - }) - return output -end - --- Return a table with the account-details -local function get_usersettings(userid) - local output = {} - local filecontent = fs.read_file_as_array(configfile) - for i=1,table.maxn(filecontent) do - local l = filecontent[i] - if not (string.find ( l, "^[;#].*" )) and not (string.find (l, "^%s*$")) then - local useroptions = format.string_to_table(l,":") - local userroles = {} - for k,v in pairs(format.string_to_table(useroptions[4],",")) do - userroles[v] = true - end - if not (userid) or ( (userid) and (userid == useroptions[1]) ) then - table.insert(output, cfe({ - name=useroptions[1], - value=useroptions[1], - label=useroptions[1], - fulltext=string.match(l,"(.-)%s*$"), - -- password=useroptions[2], - descr=useroptions[3], - roles=userroles, - -- errtxt="Account is locked!", - })) - end - end - end - return output -end - ---setup so that it will compare password input -local function set (self, userid, cmd1, cmd2) - if cmd1 ~= cmd2 then report = "Invalid or non matching password. Try again" - else - command = "/usr/bin/cryptpw" .. " " .. cmd1 - f = io.popen(command) - c = f:read("*l") - f:close() - --this is hardcoded for root should be easy to change - newpass = "root:" .. c - t = fs.search_replace("/etc/shadow", "root:[!%w%$%/%.]+", newpass) - fs.write_file("/etc/shadow", fs.ipairs_string(t)) - report = "Success. New password set." - end - return( cfe{value=report, name="report"}) -end - --- ################################################################################ --- PUBLIC FUNCTIONS - --- Present some general status -function getstatus() - local status = {} - status.users = get_usersettings() - - local roles = "" - --Rewrite roles into a presentable textstring - for k,v in pairs(status.users) do - for kk,vv in pairs(v.roles) do - roles = kk.. " / " .. roles - end - v.roles = roles - roles = "" - end - - --- status.roles = get_roles() - return status -end - -function getsettings(userid) - local settings = {} - local usersettings = get_usersettings(userid) - - settings.userid = usersettings[1] - settings.userid.label = "User id" - - settings.roles = get_roles() - ----[[ - settings.descr = cfe({ - name="descr", - value=usersettings[1].descr, - label="Description", --- fulltext=string.match(l,"(.-)%s*$"), --- password=useroptions[2], --- descr=useroptions[3], --- roles=userroles, --- errtxt="Account is locked!", - }) ---]] - return settings -end |