[ Index ]

PHP Cross Reference of Unnamed Project

title

Body

[close]

/se3-logonpy/usr/share/se3/logonpy_Win9x/ -> logon.py (source)

   1  #!/usr/bin/python
   2  # -*- coding: utf-8 -*-
   3  
   4  import sys, time
   5  from se3DB        import *
   6  from se3LDAP      import *
   7  from se3Logon     import *
   8  from se3Templates import *
   9  from se3Utils     import *
  10  from se3Reg       import *
  11  
  12  nbArgs = len (sys.argv)
  13  
  14  if nbArgs != 4:
  15      print "Usage: logon.py user computer arch"
  16      sys.exit (1)
  17  
  18  # Get cmd line args
  19  user = sys.argv[1]
  20  computer = sys.argv[2]
  21  arch     = sys.argv[3]
  22  
  23  #########################
  24  # Get se3 configuration #
  25  #########################
  26  se3db = se3DB (user, arch)
  27  rest = []
  28  slapdIp         = se3db.getValue ("ldap_server")
  29  slapdPort       = se3db.getValue ("ldap_port")
  30  adminRdn        = se3db.getValue ("adminRdn")
  31  adminPw         = se3db.getValue ("adminPw")
  32  baseDn          = se3db.getValue ("ldap_base_dn")
  33  peopleRdn       = se3db.getValue ("peopleRdn")
  34  computersRdn    = se3db.getValue ("computersRdn")
  35  parcsRdn        = se3db.getValue ("parcsRdn")
  36  groupsRdn       = se3db.getValue ("groupsRdn")
  37  path2BatFiles   = se3db.getValue ("path2BatFiles")
  38  path2Templates  = se3db.getValue ("path2Templates")
  39  xpPass          = se3db.getValue ("xppass")
  40  
  41  #########################
  42  # Get LDAP informations #
  43  #########################
  44  ldap = se3LDAP (slapdIp, slapdPort, adminRdn, adminPw,\
  45                  baseDn, peopleRdn, computersRdn, groupsRdn, parcsRdn)
  46  
  47  groups = []
  48  parcs  = []
  49  # Lowercase parcs/groups  
  50  for group in ldap.getUserGroups (user):
  51      groups.append (group.lower ())
  52  for parc in ldap.getComputerParcs (computer):
  53      parcs.append (parc.lower ())
  54  
  55  master   = ldap.getSe3Master ()
  56  
  57  del ldap
  58  
  59  
  60  ###########################
  61  # Create needed directories
  62  ###########################
  63  if not os.access ("%s/machine" % path2BatFiles, os.F_OK):
  64      os.mkdir ("%s/machine" % path2BatFiles)
  65  if not os.access ("%s/machine/%s" % (path2BatFiles, computer), os.F_OK):
  66      os.mkdir ("%s/machine/%s" % (path2BatFiles, computer))
  67  
  68  templates=["base"] + groups + parcs + [computer] + [user] + ["%s@@%s" % (user, computer)]
  69  for parc in parcs:
  70      templates += (["%s@@%s" % (user, parc)])
  71  
  72  for group in groups:
  73      templates += (["%s@@%s" % (group, computer)])
  74      for parc in parcs:
  75          templates += (["%s@@%s" % (group, parc)])
  76  
  77  #######################
  78  # User logon creation #
  79  #######################
  80  logon = se3Logon (path2BatFiles, path2Templates, user, computer, master, arch)
  81  
  82  logon.addTemplateslogon (templates)
  83  
  84  ##############################
  85  # User restrictions creation #
  86  ##############################
  87  
  88  restrictions = se3db.getRestrictions (templates)
  89  
  90  regVBS = se3Reg (path2BatFiles, computer)
  91  regVBS.addRest (restrictions )
  92  del regVBS
  93  
  94  ##########################
  95  # Desktop and Start Menu #
  96  ##########################
  97  template = se3Templates (path2Templates, path2BatFiles, user)
  98  
  99  template.cleanDesktop ()
 100  template.cleanStartMenu ()
 101  
 102  for group in groups:
 103      template.createDesktop (["%s@@%s" % (group, computer)])
 104      template.createStartMenu (["%s@@%s" % (group, computer)])
 105      for parc in parcs:
 106          template.createDesktop (["%s@@%s" % (group, parc)])
 107          template.createStartMenu (["%s@@%s" % (group, parc)])
 108  
 109  template.createDesktop (["%s@@%s" % (user, computer)])
 110  template.createStartMenu (["%s@@%s" % (user, computer)])
 111  
 112  for parc in parcs:
 113      template.createDesktop (["%s@@%s" % (user, parc)])
 114      template.createStartMenu (["%s@@%s" % (user, parc)])
 115  
 116  template.createDesktop ([computer])
 117  template.createStartMenu ([computer])
 118  
 119  template.createDesktop ([user])
 120  template.createStartMenu ([user])
 121  
 122  template.createDesktop (parcs)
 123  template.createStartMenu (parcs)
 124  
 125  template.createDesktop (groups)
 126  template.createStartMenu (groups)
 127  
 128  template.createDesktop (["base"])
 129  template.createStartMenu (["base"])
 130  
 131  del se3db
 132  del template
 133  del parcs
 134  del groups
 135  
 136  sys.exit (0)


Generated: Tue Mar 17 22:47:18 2015 Cross-referenced by PHPXref 0.7.1