Prechádzať zdrojové kódy

Revoke Grant permission
modified: TurboBird.lpi
modified: TurboBird.res
modified: permissionmanage.lfm
modified: permissionmanage.lrs
modified: permissionmanage.pas

motaz 13 rokov pred
rodič
commit
61a3b062d3
5 zmenil súbory, kde vykonal 99 pridanie a 21 odobranie
  1. 64 16
      TurboBird.lpi
  2. BIN
      TurboBird.res
  3. 2 2
      permissionmanage.lfm
  4. 2 2
      permissionmanage.lrs
  5. 31 1
      permissionmanage.pas

+ 64 - 16
TurboBird.lpi

@@ -17,8 +17,8 @@
       <UseVersionInfo Value="True"/>
       <AutoIncrementBuild Value="True"/>
       <MinorVersionNr Value="9"/>
-      <RevisionNr Value="5"/>
-      <BuildNr Value="1074"/>
+      <RevisionNr Value="6"/>
+      <BuildNr Value="1075"/>
       <StringTable ProductVersion="0.9"/>
     </VersionInfo>
     <BuildModes Count="1">
@@ -115,7 +115,6 @@
         <HasResources Value="True"/>
         <ResourceBaseClass Value="Form"/>
         <UnitName Value="QueryWindow"/>
-        <IsVisibleTab Value="True"/>
         <EditorIndex Value="5"/>
         <WindowIndex Value="0"/>
         <TopLine Value="944"/>
@@ -456,7 +455,7 @@
         <UnitName Value="SysTables"/>
         <EditorIndex Value="1"/>
         <WindowIndex Value="0"/>
-        <TopLine Value="571"/>
+        <TopLine Value="568"/>
         <CursorPos X="3" Y="573"/>
         <UsageCount Value="200"/>
         <Loaded Value="True"/>
@@ -625,7 +624,7 @@
         <WindowIndex Value="0"/>
         <TopLine Value="13"/>
         <CursorPos X="22" Y="54"/>
-        <UsageCount Value="196"/>
+        <UsageCount Value="197"/>
       </Unit60>
       <Unit61>
         <Filename Value="unitfirebirdservices.pas"/>
@@ -691,7 +690,7 @@
         <WindowIndex Value="0"/>
         <TopLine Value="3"/>
         <CursorPos X="71" Y="7"/>
-        <UsageCount Value="166"/>
+        <UsageCount Value="167"/>
       </Unit68>
       <Unit69>
         <Filename Value="changepass.pas"/>
@@ -702,7 +701,7 @@
         <WindowIndex Value="0"/>
         <TopLine Value="3"/>
         <CursorPos X="88" Y="14"/>
-        <UsageCount Value="165"/>
+        <UsageCount Value="166"/>
       </Unit69>
       <Unit70>
         <Filename Value="permissionmanage.pas"/>
@@ -711,11 +710,12 @@
         <HasResources Value="True"/>
         <ResourceBaseClass Value="Form"/>
         <UnitName Value="PermissionManage"/>
+        <IsVisibleTab Value="True"/>
         <EditorIndex Value="3"/>
         <WindowIndex Value="0"/>
-        <TopLine Value="341"/>
-        <CursorPos X="17" Y="342"/>
-        <UsageCount Value="163"/>
+        <TopLine Value="277"/>
+        <CursorPos X="27" Y="308"/>
+        <UsageCount Value="164"/>
         <Loaded Value="True"/>
         <LoadedDesigner Value="True"/>
       </Unit70>
@@ -728,7 +728,7 @@
         <WindowIndex Value="0"/>
         <TopLine Value="1"/>
         <CursorPos X="35" Y="66"/>
-        <UsageCount Value="148"/>
+        <UsageCount Value="149"/>
       </Unit71>
       <Unit72>
         <Filename Value="../../lazarus/lazarus/lcl/include/menuitem.inc"/>
@@ -753,7 +753,7 @@
         <WindowIndex Value="0"/>
         <TopLine Value="18"/>
         <CursorPos X="1" Y="44"/>
-        <UsageCount Value="119"/>
+        <UsageCount Value="120"/>
       </Unit74>
       <Unit75>
         <Filename Value="/usr/lib/lazarus/0.9.30/lcl/comctrls.pp"/>
@@ -946,7 +946,7 @@
         <WindowIndex Value="0"/>
         <TopLine Value="31"/>
         <CursorPos X="19" Y="39"/>
-        <UsageCount Value="87"/>
+        <UsageCount Value="88"/>
       </Unit98>
       <Unit99>
         <Filename Value="../../FromInternet/fpc2.4/fpc-2.4.4/packages/ibase/src/ibase60dyn.pp"/>
@@ -982,7 +982,7 @@
         <WindowIndex Value="0"/>
         <TopLine Value="666"/>
         <CursorPos X="3" Y="668"/>
-        <UsageCount Value="74"/>
+        <UsageCount Value="75"/>
         <Loaded Value="True"/>
         <LoadedDesigner Value="True"/>
       </Unit102>
@@ -1018,10 +1018,10 @@
         <WindowIndex Value="0"/>
         <TopLine Value="1"/>
         <CursorPos X="1" Y="1"/>
-        <UsageCount Value="20"/>
+        <UsageCount Value="21"/>
       </Unit106>
     </Units>
-    <JumpHistory Count="6" HistoryIndex="5">
+    <JumpHistory Count="18" HistoryIndex="17">
       <Position1>
         <Filename Value="TurboBird.lpr"/>
         <Caret Line="24" Column="23" TopLine="13"/>
@@ -1046,6 +1046,54 @@
         <Filename Value="querywindow.pas"/>
         <Caret Line="977" Column="1" TopLine="951"/>
       </Position6>
+      <Position7>
+        <Filename Value="permissionmanage.pas"/>
+        <Caret Line="342" Column="17" TopLine="341"/>
+      </Position7>
+      <Position8>
+        <Filename Value="permissionmanage.pas"/>
+        <Caret Line="288" Column="3" TopLine="284"/>
+      </Position8>
+      <Position9>
+        <Filename Value="permissionmanage.pas"/>
+        <Caret Line="277" Column="42" TopLine="242"/>
+      </Position9>
+      <Position10>
+        <Filename Value="permissionmanage.pas"/>
+        <Caret Line="288" Column="3" TopLine="284"/>
+      </Position10>
+      <Position11>
+        <Filename Value="permissionmanage.pas"/>
+        <Caret Line="264" Column="3" TopLine="257"/>
+      </Position11>
+      <Position12>
+        <Filename Value="permissionmanage.pas"/>
+        <Caret Line="437" Column="3" TopLine="435"/>
+      </Position12>
+      <Position13>
+        <Filename Value="permissionmanage.pas"/>
+        <Caret Line="150" Column="1" TopLine="128"/>
+      </Position13>
+      <Position14>
+        <Filename Value="permissionmanage.pas"/>
+        <Caret Line="162" Column="48" TopLine="135"/>
+      </Position14>
+      <Position15>
+        <Filename Value="permissionmanage.pas"/>
+        <Caret Line="301" Column="3" TopLine="297"/>
+      </Position15>
+      <Position16>
+        <Filename Value="permissionmanage.pas"/>
+        <Caret Line="307" Column="45" TopLine="275"/>
+      </Position16>
+      <Position17>
+        <Filename Value="permissionmanage.pas"/>
+        <Caret Line="296" Column="102" TopLine="277"/>
+      </Position17>
+      <Position18>
+        <Filename Value="permissionmanage.pas"/>
+        <Caret Line="318" Column="3" TopLine="314"/>
+      </Position18>
     </JumpHistory>
   </ProjectOptions>
   <CompilerOptions>

BIN
TurboBird.res


+ 2 - 2
permissionmanage.lfm

@@ -160,7 +160,7 @@ object fmPermissionManage: TfmPermissionManage
         Left = 318
         Height = 24
         Top = 34
-        Width = 58
+        Width = 66
         AutoSize = False
         Caption = 'All'
         Font.Style = [fsBold]
@@ -170,7 +170,7 @@ object fmPermissionManage: TfmPermissionManage
       object cxAllGrant: TCheckBox
         Left = 345
         Height = 24
-        Top = 51
+        Top = 53
         Width = 110
         AutoSize = False
         Caption = 'With Grant'

+ 2 - 2
permissionmanage.lrs

@@ -39,9 +39,9 @@ LazarusResources.Add('TfmPermissionManage','FORMDATA',[
   +'th'#2'c'#7'Caption'#6#10'With Grant'#8'TabOrder'#2#11#0#0#9'TCheckBox'#17'c'
   +'xReferencesGrant'#4'Left'#3'Y'#1#6'Height'#2#24#3'Top'#3'3'#1#5'Width'#2'c'
   +#7'Caption'#6#10'With Grant'#8'TabOrder'#2#12#0#0#9'TCheckBox'#5'cxAll'#4'Le'
-  +'ft'#3'>'#1#6'Height'#2#24#3'Top'#2'"'#5'Width'#2':'#8'AutoSize'#8#7'Caption'
+  +'ft'#3'>'#1#6'Height'#2#24#3'Top'#2'"'#5'Width'#2'B'#8'AutoSize'#8#7'Caption'
   +#6#3'All'#10'Font.Style'#11#6'fsBold'#0#10'ParentFont'#8#8'TabOrder'#2#13#0#0
-  +#9'TCheckBox'#10'cxAllGrant'#4'Left'#3'Y'#1#6'Height'#2#24#3'Top'#2'3'#5'Wid'
+  +#9'TCheckBox'#10'cxAllGrant'#4'Left'#3'Y'#1#6'Height'#2#24#3'Top'#2'5'#5'Wid'
   +'th'#2'n'#8'AutoSize'#8#7'Caption'#6#10'With Grant'#10'Font.Style'#11#6'fsBo'
   +'ld'#0#10'ParentFont'#8#8'TabOrder'#2#14#0#0#0#9'TTabSheet'#7'tsViews'#7'Cap'
   +'tion'#6#5'Views'#12'ClientHeight'#3'Q'#1#11'ClientWidth'#3#236#1#0#6'TLabel'

+ 31 - 1
permissionmanage.pas

@@ -96,6 +96,13 @@ type
     RoleGrant: array of Boolean;
     OrigRoleGrant: array of Boolean;
     fOnCommitProcedure: TNotifyEvent;
+
+    OldTableSelectGrant: Boolean;
+    OldTableInsertGrant: Boolean;
+    OldTableUpdateGrant: Boolean;
+    OldTableDeleteGrant: Boolean;
+    OldTableReferencesGrant: Boolean;
+
     procedure UpdatePermissions;
     procedure UpdateViewsPermissions;
     procedure UpdateProcPermissions;
@@ -147,6 +154,12 @@ begin
     cxUpdateGrant.Checked:= Pos('UG', Permissions) > 0;;
     cxDeleteGrant.Checked:= Pos('DG', Permissions) > 0;;
     cxReferencesGrant.Checked:= Pos('RG', Permissions) > 0;;
+
+    OldTableSelectGrant:= cxSelectGrant.Checked;
+    OldTableInsertGrant:= cxInsertGrant.Checked;
+    OldTableUpdateGrant:= cxUpdateGrant.Checked;
+    OldTableDeleteGrant:= cxDeleteGrant.Checked;
+    OldTableReferencesGrant:= cxReferencesGrant.Checked;
   end;
 
 end;
@@ -275,9 +288,26 @@ begin
   Line:= Command +  OptionName + ' on ' + ATableName + ToFrom + cbUsers.Text;
   if Grant and WithGrant then
       Line:= Line + ' with grant option';
-
   Line:= Line + ';';
 
+  if (Grant) and (not WithGrant) then
+  begin
+    if OldTableSelectGrant and not cxSelectGrant.Checked and (LowerCase(OptionName) = 'select') then
+      Line:= Line + #10 + 'REVOKE GRANT OPTION FOR SELECT ON ' + ATableName + ' FROM ' + cbUsers.Text + ';';
+
+    if OldTableUpdateGrant and not cxUpdateGrant.Checked and (LowerCase(OptionName) = 'update') then
+      Line:= Line + #10 + 'REVOKE GRANT OPTION FOR Update ON ' + ATableName + ' FROM ' + cbUsers.Text + ';';
+
+    if OldTableReferencesGrant and not cxReferencesGrant.Checked and (LowerCase(OptionName) = 'references') then
+      Line:= Line + #10 + 'REVOKE GRANT OPTION FOR References ON ' + ATableName + ' FROM ' + cbUsers.Text + ';';
+
+    if OldTableDeleteGrant and not cxDeleteGrant.Checked and (LowerCase(OptionName) = 'delete') then
+      Line:= Line +#10 +  'REVOKE GRANT OPTION FOR Delete ON ' + ATableName + ' FROM ' + cbUsers.Text + ';';
+
+    if OldTableInsertGrant and not cxInsertGrant.Checked and (LowerCase(OptionName) = 'insert') then
+      Line:= Line  +#10 +  'REVOKE GRANT OPTION FOR Insert ON ' + ATableName + ' FROM ' + cbUsers.Text + ';';
+  end;
+
   List.Add(Line);
 end;