[ Index ] |
PHP Cross Reference of Unnamed Project |
[Summary view] [Print] [Text view]
1 #!/usr/bin/python 2 # -*- coding: utf-8 -*- 3 4 import sys, time 5 from se3DB import * 6 from se3LDAP import * 7 from se3Profile import * 8 from se3Logon import * 9 from se3Templates import * 10 from se3Printers import * 11 from se3Utils import * 12 from se3GPO import * 13 14 nbArgs = len (sys.argv) 15 16 if nbArgs != 4: 17 print "Usage: logon.py user computer arch" 18 sys.exit (1) 19 20 # Get cmd line args 21 user = sys.argv[1] 22 computer = sys.argv[2] 23 arch = sys.argv[3] 24 25 ######################### 26 # Get se3 configuration # 27 ######################### 28 se3db = se3DB (user, arch) 29 rest = [] 30 slapdIp = se3db.getValue ("ldap_server") 31 slapdPort = se3db.getValue ("ldap_port") 32 adminRdn = se3db.getValue ("adminRdn") 33 adminPw = se3db.getValue ("adminPw") 34 baseDn = se3db.getValue ("ldap_base_dn") 35 peopleRdn = se3db.getValue ("peopleRdn") 36 computersRdn = se3db.getValue ("computersRdn") 37 parcsRdn = se3db.getValue ("parcsRdn") 38 groupsRdn = se3db.getValue ("groupsRdn") 39 path2BatFiles = se3db.getValue ("path2BatFiles") 40 path2Templates = se3db.getValue ("path2Templates") 41 xpPass = se3db.getValue ("xppass") 42 urlse3 = se3db.getValue ("urlse3") 43 ######################### 44 # Get LDAP informations # 45 ######################### 46 ldap = se3LDAP (slapdIp, slapdPort, adminRdn, adminPw,\ 47 baseDn, peopleRdn, computersRdn, groupsRdn, parcsRdn) 48 49 groups = [] 50 parcs = [] 51 # Lowercase parcs/groups 52 for group in ldap.getUserGroups (user): 53 groups.append (group.lower ()) 54 for parc in ldap.getComputerParcs (computer): 55 parcs.append (parc.lower ()) 56 57 master = ldap.getSe3Master () 58 59 printers = [] 60 for parc in parcs: 61 printers += ldap.getParcPrinters (parc) 62 63 profileStatus = ldap.getNtUserProfileStatus (user) 64 if profileStatus == "del": 65 ldap.setNtUserProfileStatus (user, "unlock") 66 67 del ldap 68 69 ######################## 70 # User profile actions # 71 ######################## 72 profile = se3Profile (user) 73 74 if profileStatus == "del": 75 remove ("/home/profiles/%s" % user) 76 remove ("/home/profiles/%s.V2" % user) 77 elif profileStatus == "lock": 78 profile.lock () 79 else: 80 profile.unlock () 81 82 try: 83 if os.access ("/home/%s/profil/delHive" % user, os.F_OK): 84 remove ("/home/profiles/%s" % user) 85 remove ("/home/profiles/%s.V2" % user) 86 os.remove ("/home/%s/profil/delHive" % user) 87 except: pass 88 89 templates=["base"] + groups + parcs + [computer] + [user] 90 91 ########################## 92 # Desktop and Start Menu # 93 ########################## 94 template = se3Templates (path2Templates, path2BatFiles, user) 95 96 template.cleanDesktop () 97 template.cleanStartMenu () 98 99 templatesdirs = template.getTemplates () 100 restgroupes = [] 101 for dir in templatesdirs: 102 for group in dir.split ('@@'): 103 for templ in templates: 104 if templ == group : 105 test = 1 106 break 107 else: 108 test = 0 109 if test == 0 : 110 break 111 if test == 1 : 112 restgroupes.append (dir) 113 template.createDesktop ([dir]) 114 template.createStartMenu ([dir]) 115 116 ####################### 117 # User logon creation # 118 ####################### 119 logon = se3Logon (path2BatFiles, path2Templates, user, computer, master, arch, urlse3) 120 121 logon.addReglogon () 122 logon.winsAdd () 123 logon.addFirefoxAutoConfig () 124 logon.addgetGPOversion () 125 logon.addTemplateslogon (restgroupes) 126 logon.addTemplateslogoff (restgroupes) 127 128 ############################## 129 # User restrictions creation # 130 ############################## 131 132 restrictions = se3db.getRestrictions (restgroupes) 133 134 gpo = se3GPO (path2BatFiles, user, computer, arch, master) 135 gpo.addRest (restrictions) 136 del gpo 137 138 139 ############################## 140 # Printers installation # 141 ############################## 142 printersVBS = se3Printers (path2BatFiles, user, computer, master) 143 printersVBS.clean () 144 printersVBS.add (printers) 145 del printersVBS 146 del se3db 147 del template 148 del parcs 149 del groups 150 151 sys.exit (0)
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Tue Mar 17 22:47:18 2015 | Cross-referenced by PHPXref 0.7.1 |