1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69
| if XMLApplication.InitParams.Values['XMLC_Design'] = '1' then
begin
USR_NAME := 'AG27399' ;
Context.Values['code_agtp'] := '399';
Context.Values['XMLC_Authenticated'] := '1';
exit;
end;
Database := (XMLCollection as IXMLCollection2).GetDatabaseComponent('Database');
if not Database.Connected then
Database.Connected := True;
Database.StartTransaction;
try
try
e.Handled := True;
XMLApplication.CheckSecurityFile;
USR_NAME := Context.Values['XMLC_UserName'];
Session := Context.Values['XMLC_Session'];
Context.Values['code_agtp'] := rightstr(USR_NAME,3);
Context.Values['id_session'] := Session;
XMLCollection.DBExtract('qryUSRSession');
if Context.Values['code_agtp'] = '' then
begin
Context.Values['XMLC_Authenticated'] := '0';
XMLRequest.RaiseError('XMLC_AUTHENTICATION_REQUIRED', 'TTrainingWM.XMLCollectionEvents1Authenticate');
end;
Expiration := StrToFloatDef(Context.Values['expiration'], 0);
if Expiration < Now then
begin
Context.Values['XMLC_Authenticated'] := '0';
XMLRequest.RaiseError('XMLC_AUTHENTICATION_REQUIRED', 'TTrainingWM.XMLCollectionEvents1Authenticate');
end;
Context.Values['XMLC_Authenticated'] := '1';
// Manage Groups
for I := 0 to XMLApplication.SecurityGroups.Count-1 do
begin
GroupFieldName := XMLApplication.SecurityGroups.GetValueNo(I);
if GroupFieldName <> '' then
Context.SetValue(GroupFieldName, '0');
end;
XMLCollection.DBExtract('qryUSRGroups');
Context.Values['XMLC_Guest'] := '1';
if Context.Values['CA_UTI_NIV'] = '3' then
begin
Context.values['XMLC_User'] := '1';
Context.values['ECOUTE_CLIENT'] := '1';
end else if Context.Values['CA_UTI_NIV'] = '2' then
begin
Context.values['XMLC_User'] := '1';
Context.values['XMLC_Administrator'] := '1';
Context.values['ECOUTE_CLIENT'] := '1';
end else if Context.Values['CA_UTI_NIV'] = '1' then
begin
Context.values['XMLC_User'] := '1';
Context.values['XMLC_Administrator'] := '1';
Context.Values['XMLC_Supervisor'] := '1';
Context.values['ECOUTE_CLIENT'] := '1';
end else if Context.Values['CA_UTI_NIV'] = '4' then
begin
Context.values['ECOUTE_CLIENT'] := '1';
end;
except
Database.Rollback;
raise;
end;
finally
Database.Commit;
end; |