Changeset 132 for trunk/Packages/CoolWeb
- Timestamp:
- Mar 18, 2022, 3:47:27 PM (3 years ago)
- Location:
- trunk/Packages/CoolWeb
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Packages/CoolWeb/CoolWeb.lpk
r114 r132 1 1 <?xml version="1.0" encoding="UTF-8"?> 2 2 <CONFIG> 3 <Package Version=" 4">3 <Package Version="5"> 4 4 <Name Value="CoolWeb"/> 5 5 <Type Value="RunAndDesignTime"/> … … 11 11 <IncludeFiles Value="WebServer"/> 12 12 <OtherUnitFiles Value="WebServer;Persistence;Network;Modules;Common;/usr/lib/mysql/;/usr/lib64/mysql/"/> 13 <UnitOutputDirectory Value="lib/$(TargetCPU)-$(TargetOS) "/>13 <UnitOutputDirectory Value="lib/$(TargetCPU)-$(TargetOS)-$(BuildMode)"/> 14 14 </SearchPaths> 15 15 <Parsing> 16 16 <SyntaxOptions> 17 17 <SyntaxMode Value="Delphi"/> 18 <CStyleOperator Value="False"/> 19 <AllowLabel Value="False"/> 20 <CPPInline Value="False"/> 18 21 </SyntaxOptions> 19 22 </Parsing> 23 <CodeGeneration> 24 <Optimizations> 25 <OptimizationLevel Value="0"/> 26 </Optimizations> 27 </CodeGeneration> 28 <Linking> 29 <Debugging> 30 <GenerateDebugInfo Value="False"/> 31 </Debugging> 32 </Linking> 33 <Other> 34 <CompilerMessages> 35 <IgnoredMessages idx6058="True" idx3124="True" idx3123="True"/> 36 </CompilerMessages> 37 </Other> 20 38 </CompilerOptions> 21 39 <Description Value="Unit set for generating CGI or server web application."/> … … 104 122 </Item18> 105 123 </Files> 124 <CompatibilityMode Value="True"/> 106 125 <RequiredPkgs Count="8"> 107 126 <Item1> -
trunk/Packages/CoolWeb/LazIDEReg.pas
r84 r132 39 39 CGIAppDescriptor: TCGIApplicationDescriptor; 40 40 41 procedure Register; 41 42 42 procedure Register;43 43 44 44 implementation … … 100 100 function TCGIApplicationDescriptor.InitProject(AProject: TLazProject): TModalResult; 101 101 var 102 le: string;103 102 NewSource: TStringList; 104 103 MainFile: TLazProjectFile; -
trunk/Packages/CoolWeb/Modules/UWebUser.pas
r114 r132 267 267 Result := False; 268 268 try 269 DbRows2 := TDbRows.Create; 270 271 // Check group-operation relation 272 Database.Select(DbRows2, 'PermissionGroupAssignment', 'Id', 273 '`User` = ' + IntToStr(Id) + ' AND `AssignedOperation` = ' + IntToStr(Operation)); 274 if DbRows2.Count > 0 then begin 269 DbRows2 := TDbRows.Create; 270 271 // Check group-operation relation 272 Database.Select(DbRows2, 'PermissionGroupAssignment', 'Id', 273 '`User` = ' + IntToStr(Id) + ' AND `AssignedOperation` = ' + IntToStr(Operation)); 274 if DbRows2.Count > 0 then begin 275 Result := True; 276 Exit; 277 end; 278 279 // Check group-group relation 280 Database.Select(DbRows2, 'PermissionGroupAssignment', 'AssignedGroup', 281 '`User` = ' + IntToStr(Id) + ' AND `AssignedGroup` IS NOT NULL'); 282 if DbRows2.Count > 0 then begin 283 if CheckGroupPermission(StrToInt(DbRows2[0].Values['AssignedGroup']), Operation) then begin 275 284 Result := True; 276 285 Exit; 277 286 end; 278 279 // Check group-group relation 280 Database.Select(DbRows2, 'PermissionGroupAssignment', 'AssignedGroup', 281 '`User` = ' + IntToStr(Id) + ' AND `AssignedGroup` IS NOT NULL'); 282 if DbRows2.Count > 0 then begin 283 if CheckGroupPermission(StrToInt(DbRows2[0].Values['AssignedGroup']), Operation) then begin 284 Result := True; 285 Exit; 286 end; 287 end; 288 finally 289 DbRows2.Free; 290 end; 287 end; 288 finally 289 DbRows2.Free; 290 end; 291 291 end; 292 292 -
trunk/Packages/CoolWeb/WebServer/UWebApp.pas
r108 r132 6 6 7 7 uses 8 Classes, SysUtils, CustApp, SpecializedList,UWebPage, UHTTPSessionFile,9 UHTTPServer, Forms, FileUtil ;8 Classes, SysUtils, UWebPage, UHTTPSessionFile, 9 UHTTPServer, Forms, FileUtil, fgl; 10 10 11 11 type … … 22 22 { TPageList } 23 23 24 TPageList = class(T ListObject)24 TPageList = class(TFPGObjectList<TRegistredPage>) 25 25 RootDir: string; 26 26 function FindByPage(Page: TWebPage): TRegistredPage; … … 29 29 procedure UnregisterPage(Page: TWebPage); 30 30 function ProducePage(HandlerData: THTTPHandlerData): Boolean; 31 constructor Create ; override;31 constructor Create(FreeObjects: Boolean = True); 32 32 end; 33 33 … … 64 64 UHTTPServerCGI, UHTTPServerTCP, UHTTPServerTurboPower; 65 65 66 67 66 procedure Register; 68 67 begin … … 77 76 end; 78 77 79 80 78 { TPageList } 81 79 … … 85 83 begin 86 84 I := 0; 87 while (I < Count) and ( TRegistredPage(Items[I]).Page <> Page) do Inc(I);88 if I < Count then Result := TRegistredPage(Items[I])85 while (I < Count) and (Items[I].Page <> Page) do Inc(I); 86 if I < Count then Result := Items[I] 89 87 else Result := nil; 90 88 end; … … 95 93 begin 96 94 I := 0; 97 while (I < Count) and ( TRegistredPage(Items[I]).Name <> Name) do Inc(I);98 if I < Count then Result := TRegistredPage(Items[I])95 while (I < Count) and (Items[I].Name <> Name) do Inc(I); 96 if I < Count then Result := Items[I] 99 97 else Result := nil; 100 98 end; … … 132 130 var 133 131 NewPage: TRegistredPage; 134 Instance: TWebPage; 135 begin 136 NewPage := TRegistredPage(AddNew(TRegistredPage.Create)); 132 begin 133 NewPage := TRegistredPage.Create; 137 134 // NewPage.Page := PageClass.Create(Self); 138 135 NewPage.Page := Page; 139 136 NewPage.Name := Path; 137 Add(NewPage); 140 138 end; 141 139 … … 166 164 constructor TPageList.Create; 167 165 begin 168 inherited Create;169 OwnsObjects := False;166 inherited; 167 FreeObjects := False; 170 168 end; 171 169 … … 212 210 constructor TWebApp.Create(AOwner: TComponent); 213 211 begin 214 inherited Create(AOwner);212 inherited; 215 213 HTTPServer := THTTPServerCGI.Create(nil); 216 214 HTTPServer.OnRequest := HTTPServerRequest; … … 219 217 destructor TWebApp.Destroy; 220 218 begin 221 HTTPServer.Free;222 inherited Destroy;219 FreeAndNil(HTTPServer); 220 inherited; 223 221 end; 224 222
Note:
See TracChangeset
for help on using the changeset viewer.