Function CreateDefaultUser (sIdEns As String, uName As String, sBase As String, UserBase As String, sRules As String) As Integer
Dim Ret%
Dim sData$
Dim i%
Dim s$
Dim screa$
Dim sRef$
sRef = GlobPU.XasName
CreateDefaultUser = False
s = UCase$(uName)
screa = Date$
Ret = pExecute("CLEAR")
sData = "INSERT INTO XmlUser (creation,Maj,Type,Enabled,profile,method,charte,police,langue,"
sData = sData + "name,password,text,fileperso,databaseactif,datapredictif,email,phone,fax,CodeClient,XmlRules,byref) VALUES ("
sData = sData + "'" + screa + "','" + screa + "','2','1','3','XASDRM','BLACK','VERDANA','33',"
sData = sData + "'" + s + "','" + s + "','Bureau " + s + "','PERSO.XML',"
sData = sData + "'" + sBase + "','" + sBase + "','nomail','00000000','00000000','" + CStr(sIdEns) + "','" + sRules + "','" + sRef + "')"
Ret = pExecute(sData)
If Ret = True Then
i = XasSystemCreateUser(s, s, "3", "0111100", sBase)
If i = True Then
'Ret = UpdateGuestPerso(UserBase, s)
Ret = CopySQLUserPerso(sRef, s, GlobPU.Connect)
CreateDefaultUser = i
End If
End If
If TabSQLValue(0, 30) = "" Then
TabSQLValue(0, 30) = sBase + "66"
TabSQLValue(0, 31) = sBase + "66"
End If
s = TabSQLValue(0, 30)
Ret = pExecute("CLEAR")
sData = "INSERT INTO XmlUser (creation,Maj,Type,Enabled,profile,method,charte,police,langue,"
sData = sData + "name,password,text,fileperso,databaseactif,datapredictif,email,phone,fax,CodeClient,XmlRules,byref) VALUES ("
sData = sData + "'" + screa + "','" + screa + "','1','1','7','XASDRM','BLACK','VERDANA','33',"
sData = sData + "'" + TabSQLValue(0, 30) + "','" + TabSQLValue(0, 31) + "','Administrateur " + s + "','PERSO.XML',"
sData = sData + "'" + sBase + "','" + sBase + "','nomail','00000000','00000000','" + CStr(sIdEns) + "','" + sRules + "','" + sRef + "')"
Ret = pExecute(sData)
If Ret = True Then
i = XasSystemCreateUser(TabSQLValue(0, 30), TabSQLValue(0, 31), "7", "0111100", sBase)
If i = True Then
Ret = CopySQLUserPerso(sRef, s, GlobPU.Connect)
Ret = UpdateStringCarto(s, 1, "33")
CreateDefaultUser = i
End If
End If
End Function
|