Ich bin im Moment völlig ratlos. Ich arbeite an einem ASP.NET Projekt in dem mich mir eine Klasse für Benutzerrechte (für den Zugang zur Webseitenfuntionalität) gebaut habe. Diese ist von TObject abgeleitet und deren Interface ist wie folgt definiert:
Delphi-Quellcode:
{$REGION 'RightsStructure'}
type TServerActionValues = record
all : Boolean;
add : Boolean;
edit: Boolean;
editAccUser: Boolean;
editAccVehicles: Boolean;
end;
type TOwnAccActionsValues = record
all : Boolean;
add : Boolean;
edit: Boolean;
editOwnPassword: Boolean;
SetupUserRights: Boolean;
end;
type TOwnJouneyActionsValues = record
all : Boolean;
add : Boolean;
edit: Boolean;
end;
type TOwnVehicleActionsValues = record
all : Boolean;
edit: Boolean;
end;
type TOwnAlarmActionsValues = record
all : Boolean;
add : Boolean;
edit: Boolean;
end;
type TViewVehicleActionsValues = record
all : Boolean;
view : Boolean;
end;
type TViewJourneyActionsValues = record
all : Boolean;
view : Boolean;
viewOwn : Boolean;
end;
type TViewDataActionsValues = record
all : Boolean;
viewVehicleSetup: Boolean;
viewActuals : Boolean;
viewHistory : Boolean;
viewAlarms : Boolean;
end;
type TViewMapActionsValues = record
all : Boolean;
viewActuals : Boolean;
viewHistory : Boolean;
viewAlarms : Boolean;
Zooming : Boolean;
Tracing : Boolean;
end;
{$ENDREGION}
{$REGION 'Constant Strings'}
type TServerActions = record
const all : String = 'ALL';
const add : String = 'ADD';
const edit: String = 'EDIT';
const editAccUser: String = 'ACCUSEREDIT';
const editAccVehicles: String = 'ACCVEHICLEEDIT';
end;
type TOwnAccActions = record
const all : String = 'ALL';
const add : String = 'ADD';
const edit: String = 'EDIT';
const editOwnPassword: String = 'OWNPW';
const SetupUserRights: String = 'URSETUP';
end;
type TOwnJouneyActions = record
const all : String = 'ALL';
const add : String = 'ADD';
const edit: String = 'EDIT';
end;
type TOwnVehicleActions = record
const all : String = 'ALL';
const edit: String = 'EDIT';
end;
type TOwnAlarmActions = record
const all : String = 'ALL';
const add : String = 'ADD';
const edit: String = 'EDIT';
end;
type TViewVehicleActions = record
const all : String = 'ALL';
const view : String = 'VIEW';
end;
type TViewJourneyActions = record
const all : String = 'ALL';
const view : String = 'VIEW';
const viewOwn : String = 'VIEWOWN';
end;
type TViewDataActions = record
const all : String = 'ALL';
const viewVehicleSetup: String = 'SETTINGS';
const viewActuals : String = 'ACTUALS';
const viewHistory : String = 'HISTORY';
const viewAlarms : String = 'ALARMS';
end;
type TViewMapActions = record
const all : String = 'ALL';
const viewActuals : String = 'ACTUALS';
const viewHistory : String = 'HISTORY';
const viewAlarms : String = 'ALARMS';
const Zooming : String = 'ZOOM';
const Tracing : String = 'TRACE';
end;
type TUserActions = record
ServerSetup : TServerActions;
OwnAccSetup : TOwnAccActions;
OwnJourneysSetup: TOwnJouneyActions;
OwnVehicleSetup : TOwnVehicleActions;
OwnAlarmsSetup : TOwnAlarmActions;
OwnVehiclesView : TViewVehicleActions;
OwnJourneysView : TViewJourneyActions;
DataView : TViewDataActions;
Maps : TViewMapActions;
end;
type TModuleStrings = Record
const ServerSetup : String = 'SERVERSETUP';
const OwnAccSetup : String = 'OWNACCOUNTSETUP';
const OwnJourneysSetup : String = 'OWNJOURNEYSETUP';
const OwnVehicleSetup : String = 'OWNVEHICLESETUP';
const OwnAlarmsSetup : String = 'OWNALARMSSETUP';
const OwnVehiclesView : String = 'OWNVEHICLESVIEW';
const OwnJourneysView : String = 'OWNJOURNEYSVIEW';
const DataView : String = 'DATAVIEW';
const Maps : String = 'MAPSVIEW';
end;
{$ENDREGION}
type TYN = Array[boolean] of String;
type TUserRightsSetting = record
Module : String;
Action : String;
Value : Boolean;
end;
type TUserRightsTable = record
class var
Changable : Boolean;
StandardUser : Boolean;
DataBaseID : Integer;
ServerSetup : TServerActionValues;
OwnAccSetup : TOwnAccActionsValues;
OwnJourneysSetup : TOwnJouneyActionsValues;
OwnVehicleSetup : TOwnVehicleActionsValues;
OwnAlarmsSetup : TOwnAlarmActionsValues;
OwnVehiclesView : TViewVehicleActionsValues;
OwnJourneysView : TViewJourneyActionsValues;
DataView : TViewDataActionsValues;
Maps : TViewMapActionsValues;
end;
{$REGION 'Private Declarations'}
private
{ Private Declarations }
ModulesStr : TModuleStrings;
ActionsStr : TUserActions;
Rights : TUserRightsTable;
function getChangable : boolean;
function getStandardUser : boolean;
procedure setChangable(value: Boolean);
procedure setStandardUser(value : Boolean);
function getDataBaseID : Integer;
procedure setDataBaseID(DBID: Integer);
function getRightItems : Integer;
function getRightItem(itemid: integer):TUserRightsSetting;
function getItemCount(item : Integer; var UserRightItem : TUserRightsSetting) :Integer;
{$ENDREGION}
{$REGION 'public Declarations'}
public
constructor Create;
property Modules : TModuleStrings read ModulesStr;
property Actions : TUserActions read ActionsStr;
property DBID : Integer read getDataBaseID write setDataBaseID;
property isChangable : Boolean read getChangable write setChangable;
property isStandardUser : Boolean read getStandardUser write setStandardUser;
property Items : Integer read getRightItems;
property Item[itemid : integer] : TUserRightsSetting read getRightItem;
procedure CopyRightsFrom(Input : TUserRightsTable);
function getRightsTable : TUserRightsTable;
property RightsTable : TUserRightsTable read getRightsTable write CopyRightsFrom;
function getRightFor(currModule: String; currAction: String): Boolean;
procedure setRightFor(currModule: String; currAction: String; currValue :Boolean);
function getRightForAsYN(currModule: String; currAction: String): String;
procedure setRightForAsYN(currModule: String; currAction: String; currValue :String);
function getChangableAsYN : String;
function getStandardUserAsYN : String;
procedure setChangableAsYN(value: String);
procedure setStandardUserAsYN(value : String);
{$ENDREGION}
end;
Mein Problem ist dabei nun, daß ich solange ich ein Object, das mit dieser Klasse instaziert wurde, allein verwende keine Probleme habe, wenn aber ein 2. Object instanziert wird, scheinen beide den selben Speicherraum zu verwenden. Da ich kein absoluter O-O Freak bin, bin ich sicher, daß ich irgendetwas nicht beachtet habe. Nur Was?