User upgrade from -cfg should now work

This commit is contained in:
mysticbbs 2012-07-30 18:21:06 -04:00
parent f1a0cceb4d
commit e11e090702
2 changed files with 31 additions and 26 deletions

View File

@ -126,7 +126,7 @@ Begin
Form.AddByte ('S', ' Security' , 7, 6, 23, 6, 14, 3, 0, 255, @U.Security, Topic + 'User''s security level'); Form.AddByte ('S', ' Security' , 7, 6, 23, 6, 14, 3, 0, 255, @U.Security, Topic + 'User''s security level');
Form.AddFlag ('1', ' Flags #1' , 7, 7, 23, 7, 14, @U.AF1, Topic + 'User''s access flags: Set 1'); Form.AddFlag ('1', ' Flags #1' , 7, 7, 23, 7, 14, @U.AF1, Topic + 'User''s access flags: Set 1');
Form.AddFlag ('2', ' Flags #2' , 7, 8, 23, 8, 14, @U.AF2, Topic + 'User''s access flags: Set 2'); Form.AddFlag ('2', ' Flags #2' , 7, 8, 23, 8, 14, @U.AF2, Topic + 'User''s access flags: Set 2');
Form.AddWord ('T', ' Time Left' , 7, 9, 23, 9, 14, 10, 0, 1440, @U.TimeLeft, Topic + 'Total number of minutes left for today'); Form.AddWord ('T', ' Time Left' , 7, 9, 23, 9, 14, 4, 0, 1440, @U.TimeLeft, Topic + 'Total number of minutes left for today');
Form.AddWord ('I', ' Time Bank' , 7, 10, 23, 10, 14, 5, 0, 65000, @U.TimeBank, Topic + 'Total minutes in time bank'); Form.AddWord ('I', ' Time Bank' , 7, 10, 23, 10, 14, 5, 0, 65000, @U.TimeBank, Topic + 'Total minutes in time bank');
Form.AddDate ('X', ' Expires' , 7, 11, 23, 11, 14, @U.Expires, Topic + 'User''s account expiration date (00/00/00: Disabled)'); Form.AddDate ('X', ' Expires' , 7, 11, 23, 11, 14, @U.Expires, Topic + 'User''s account expiration date (00/00/00: Disabled)');
Form.AddByte ('O', ' To' , 7, 12, 23, 12, 14, 3, 0, 255, @U.ExpiresTo, Topic + 'Security profile to give user after expiration'); Form.AddByte ('O', ' To' , 7, 12, 23, 12, 14, 3, 0, 255, @U.ExpiresTo, Topic + 'Security profile to give user after expiration');
@ -186,7 +186,8 @@ Begin
Form.AddBits ('N', ' No Ratios' , 7, 8, 23, 8, 14, UserNoRatio, @U.Flags, Topic + 'Ignore file ratios?'); Form.AddBits ('N', ' No Ratios' , 7, 8, 23, 8, 14, UserNoRatio, @U.Flags, Topic + 'Ignore file ratios?');
Form.AddBits ('C', ' No CallStats', 7, 9, 23, 9, 14, UserNoLastCall, @U.Flags, Topic + 'Exclude from caller stats?'); Form.AddBits ('C', ' No CallStats', 7, 9, 23, 9, 14, UserNoLastCall, @U.Flags, Topic + 'Exclude from caller stats?');
Form.AddBits ('P', ' No PW Change', 7, 10, 23, 10, 14, UserNoPWChange, @U.Flags, Topic + 'Exclude from forced password change'); Form.AddBits ('P', ' No PW Change', 7, 10, 23, 10, 14, UserNoPWChange, @U.Flags, Topic + 'Exclude from forced password change');
Form.AddBits ('H', ' No History' , 7, 11, 23, 11, 14, UserNoHistory, @U.Flags, Topic + 'Exclude for BBS history stats'); Form.AddBits ('H', ' No History' , 7, 11, 23, 11, 14, UserNoHistory, @U.Flags, Topic + 'Exclude from BBS history stats');
Form.AddBits ('T', ' No Timeout' , 7, 12, 23, 12, 14, UserNoTimeout, @U.Flags, Topic + 'Exclude from inactivity timeout');
End; End;
End; End;
@ -200,9 +201,10 @@ Begin
Temp := Configuration_SecurityEditor(False); Temp := Configuration_SecurityEditor(False);
If Temp <> -1 Then Begin If Temp <> -1 Then Begin
Changed := True; NeedForm := True;
Changed := True;
Upgrade_User_Level(True, U, Temp); Upgrade_User_Level(Session.User.IsThisUser(U.Handle), U, Temp);
End; End;
End; End;
#27 : Begin #27 : Begin
@ -333,6 +335,8 @@ Begin
Session.InUserEdit := False; Session.InUserEdit := False;
Session.LocalMode := SavedLocal; Session.LocalMode := SavedLocal;
Session.SetTimeLeft(Session.User.ThisUser.TimeLeft);
{$IFNDEF UNIX} {$IFNDEF UNIX}
UpdateStatusLine(StatusPtr, ''); UpdateStatusLine(StatusPtr, '');
{$ENDIF} {$ENDIF}

View File

@ -60,38 +60,39 @@ End;
Procedure Upgrade_User_Level (Now: Boolean; Var U: RecUser; Sec: Byte); Procedure Upgrade_User_Level (Now: Boolean; Var U: RecUser; Sec: Byte);
Var Var
A : Char; Flags : Char;
T : RecSecurity; TempSec : RecSecurity;
Begin Begin
Reset (Session.User.SecurityFile); Assign (Session.User.SecurityFile, Config.DataPath + 'security.dat');
Seek (Session.User.SecurityFile, Sec - 1); Reset (Session.User.SecurityFile);
Read (Session.User.SecurityFile, T); Seek (Session.User.SecurityFile, Sec - 1);
Close (Session.User.SecurityFile); Read (Session.User.SecurityFile, TempSec);
Close (Session.User.SecurityFile);
U.Security := Sec; U.Security := Sec;
U.StartMenu := T.StartMenu; U.StartMenu := TempSec.StartMenu;
U.TimeLeft := T.Time; U.TimeLeft := TempSec.Time;
U.Expires := '00/00/00'; U.Expires := '00/00/00';
U.ExpiresTo := T.ExpiresTo; U.ExpiresTo := TempSec.ExpiresTo;
If T.Expires > 0 Then If TempSec.Expires > 0 Then
U.Expires := DateJulian2Str(CurDateJulian + T.Expires, 1); U.Expires := DateJulian2Str(CurDateJulian + TempSec.Expires, 1);
For A := 'A' to 'Z' Do For Flags := 'A' to 'Z' Do
If Ord(A) - 64 in T.AF1 Then If Ord(Flags) - 64 in TempSec.AF1 Then
U.AF1 := U.AF1 + [Ord(A) - 64] U.AF1 := U.AF1 + [Ord(Flags) - 64]
Else Else
If T.Hard Then If TempSec.Hard Then
U.AF1 := U.AF1 - [Ord(A) - 64]; U.AF1 := U.AF1 - [Ord(Flags) - 64];
For A := 'A' to 'Z' Do For Flags := 'A' to 'Z' Do
If Ord(A) - 64 in T.AF2 Then If Ord(Flags) - 64 in TempSec.AF2 Then
U.AF2 := U.AF2 + [Ord(A) - 64] U.AF2 := U.AF2 + [Ord(Flags) - 64]
Else Else
If T.Hard Then If TempSec.Hard Then
U.AF2 := U.AF2 - [Ord(A) - 64]; U.AF2 := U.AF2 - [Ord(Flags) - 64];
If Now Then Session.User.Security := T; If Now Then Session.User.Security := TempSec;
End; End;
Procedure AutoSig_Edit; Procedure AutoSig_Edit;