Ignore:
Timestamp:
Mar 18, 2022, 3:47:27 PM (3 years ago)
Author:
chronos
Message:
  • Modified: Code cleanup.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Packages/CoolWeb/Modules/UWebUser.pas

    r114 r132  
    267267  Result := False;
    268268  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
    275284        Result := True;
    276285        Exit;
    277286      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;
    291291end;
    292292
Note: See TracChangeset for help on using the changeset viewer.