Advertisement
Guest User

Untitled

a guest
Jul 29th, 2015
157
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. auth.
  2. directory.
  3. domain {
  4.     id
  5.       =
  6.     "africa:names",
  7.     server
  8.       =
  9.     "LOCAL"
  10. }
  11.  
  12. auth.
  13. directory.
  14. domain {
  15.     id
  16.       =
  17.     "africa:master",
  18.     server
  19.       =
  20.     "LOCAL"
  21. }
  22.  
  23. auth.
  24. directory.
  25. domain {
  26.     id
  27.     =
  28.       "africa:admin",
  29.     server
  30.     =
  31.       "LOCAL"
  32. }
  33.  
  34. local
  35.   arr
  36. =
  37.   {
  38.     gear
  39.     =
  40.       {
  41.         admin
  42.         =
  43.           1,
  44.         master
  45.         =
  46.           1,
  47.         name
  48.         =
  49.           1
  50.       }
  51.   }
  52.  
  53. local
  54.   lfs
  55. =
  56.   require
  57.     "filesystem"
  58.  
  59. for
  60.   _,
  61.   dn
  62. in
  63.   lfs.
  64.   dir
  65.     (
  66.       "conf/auth/"
  67.     )
  68. do
  69.     if
  70.       dn
  71.       ~=
  72.         ".."
  73.     and
  74.       dn
  75.       ~=
  76.         "."
  77.     then
  78.         for
  79.           ft,
  80.           un
  81.         in
  82.           lfs.
  83.           dir
  84.             (
  85.               "conf/auth/" .. dn
  86.             )
  87.         do
  88.             if
  89.               ft
  90.               ==
  91.                 lfs.DIRECTORY
  92.             then
  93.               if
  94.                 un
  95.                 ~=
  96.                   ".."
  97.               and
  98.                 un
  99.                 ~=
  100.                   "."
  101.               then
  102.                 if
  103.                   arr[un]
  104.                   ~=
  105.                     nil
  106.                 then
  107.                     for
  108.                       ftype,
  109.                       fname
  110.                     in
  111.                       lfs.
  112.                       dir
  113.                         (
  114.                           "conf/auth/"..dn.."/"..un
  115.                         )
  116.                     do
  117.                         if
  118.                           fname
  119.                           ~=
  120.                             ".."
  121.                         and
  122.                           fname
  123.                           ~=
  124.                             "."
  125.                         then
  126.                           if
  127.                             ftype
  128.                             ==
  129.                               lfs.
  130.                               FILE
  131.                           and
  132.                             arr[un][fname]
  133.                             ~=
  134.                               nil
  135.                           then
  136.                             print
  137.                               (
  138.                                 "Found file: " .. file
  139.                               )
  140.                           else
  141.                             print
  142.                               (
  143.                                 "Auth error: File not enabled: " .. fname
  144.                               )
  145.                           end
  146.                         end
  147.                     end
  148.                 else
  149.                     print
  150.                       (
  151.                         "Auth error: User not found: " .. un
  152.                       )
  153.                 end
  154.               end
  155.             else
  156.                 print
  157.                   (
  158.                     "Auth error: Not a directory: " .. dn
  159.                   )
  160.             end
  161.         end
  162.     end
  163. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement