From e11e090702fa02bfd807eeb5ad857843e7f7350d Mon Sep 17 00:00:00 2001 From: mysticbbs Date: Mon, 30 Jul 2012 18:21:06 -0400 Subject: [PATCH] User upgrade from -cfg should now work --- mystic/bbs_cfg_useredit.pas | 12 ++++++---- mystic/bbs_general.pas | 45 +++++++++++++++++++------------------ 2 files changed, 31 insertions(+), 26 deletions(-) diff --git a/mystic/bbs_cfg_useredit.pas b/mystic/bbs_cfg_useredit.pas index 5df3df1..438c4e2 100644 --- a/mystic/bbs_cfg_useredit.pas +++ b/mystic/bbs_cfg_useredit.pas @@ -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.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.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.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'); @@ -186,7 +186,8 @@ Begin 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 ('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; @@ -200,9 +201,10 @@ Begin Temp := Configuration_SecurityEditor(False); 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; #27 : Begin @@ -333,6 +335,8 @@ Begin Session.InUserEdit := False; Session.LocalMode := SavedLocal; + Session.SetTimeLeft(Session.User.ThisUser.TimeLeft); + {$IFNDEF UNIX} UpdateStatusLine(StatusPtr, ''); {$ENDIF} diff --git a/mystic/bbs_general.pas b/mystic/bbs_general.pas index 59664dc..e9608bc 100644 --- a/mystic/bbs_general.pas +++ b/mystic/bbs_general.pas @@ -60,38 +60,39 @@ End; Procedure Upgrade_User_Level (Now: Boolean; Var U: RecUser; Sec: Byte); Var - A : Char; - T : RecSecurity; + Flags : Char; + TempSec : RecSecurity; Begin - Reset (Session.User.SecurityFile); - Seek (Session.User.SecurityFile, Sec - 1); - Read (Session.User.SecurityFile, T); - Close (Session.User.SecurityFile); + Assign (Session.User.SecurityFile, Config.DataPath + 'security.dat'); + Reset (Session.User.SecurityFile); + Seek (Session.User.SecurityFile, Sec - 1); + Read (Session.User.SecurityFile, TempSec); + Close (Session.User.SecurityFile); U.Security := Sec; - U.StartMenu := T.StartMenu; - U.TimeLeft := T.Time; + U.StartMenu := TempSec.StartMenu; + U.TimeLeft := TempSec.Time; U.Expires := '00/00/00'; - U.ExpiresTo := T.ExpiresTo; + U.ExpiresTo := TempSec.ExpiresTo; - If T.Expires > 0 Then - U.Expires := DateJulian2Str(CurDateJulian + T.Expires, 1); + If TempSec.Expires > 0 Then + U.Expires := DateJulian2Str(CurDateJulian + TempSec.Expires, 1); - For A := 'A' to 'Z' Do - If Ord(A) - 64 in T.AF1 Then - U.AF1 := U.AF1 + [Ord(A) - 64] + For Flags := 'A' to 'Z' Do + If Ord(Flags) - 64 in TempSec.AF1 Then + U.AF1 := U.AF1 + [Ord(Flags) - 64] Else - If T.Hard Then - U.AF1 := U.AF1 - [Ord(A) - 64]; + If TempSec.Hard Then + U.AF1 := U.AF1 - [Ord(Flags) - 64]; - For A := 'A' to 'Z' Do - If Ord(A) - 64 in T.AF2 Then - U.AF2 := U.AF2 + [Ord(A) - 64] + For Flags := 'A' to 'Z' Do + If Ord(Flags) - 64 in TempSec.AF2 Then + U.AF2 := U.AF2 + [Ord(Flags) - 64] Else - If T.Hard Then - U.AF2 := U.AF2 - [Ord(A) - 64]; + If TempSec.Hard Then + U.AF2 := U.AF2 - [Ord(Flags) - 64]; - If Now Then Session.User.Security := T; + If Now Then Session.User.Security := TempSec; End; Procedure AutoSig_Edit;