File tree Expand file tree Collapse file tree 1 file changed +14
-5
lines changed
Expand file tree Collapse file tree 1 file changed +14
-5
lines changed Original file line number Diff line number Diff line change @@ -83,20 +83,29 @@ async function main(
8383 // Set the IAM access policy with updated bindings.
8484 await table . setIamPolicy ( policy ) ;
8585
86- // Create a descriptive message based on what was actually removed
87- if ( roleToRemove && principalToRemove ) {
86+ // Both role and principal are removed
87+ if ( roleToRemove !== null && principalToRemove !== null ) {
8888 console . log (
8989 `Role '${ roleToRemove } ' revoked for principal '${ principalToRemove } ' on resource '${ datasetId } .${ tableId } '.`
9090 ) ;
91- } else if ( roleToRemove ) {
91+ }
92+
93+ // Only role is removed
94+ if ( roleToRemove !== null && principalToRemove === null ) {
9295 console . log (
9396 `Role '${ roleToRemove } ' revoked for all principals on resource '${ datasetId } .${ tableId } '.`
9497 ) ;
95- } else if ( principalToRemove ) {
98+ }
99+
100+ // Only principal is removed
101+ if ( roleToRemove === null && principalToRemove !== null ) {
96102 console . log (
97103 `Access revoked for principal '${ principalToRemove } ' on resource '${ datasetId } .${ tableId } '.`
98104 ) ;
99- } else {
105+ }
106+
107+ // No changes were made
108+ if ( roleToRemove === null && principalToRemove === null ) {
100109 console . log (
101110 `No changes made to access policy for '${ datasetId } .${ tableId } '.`
102111 ) ;
You can’t perform that action at this time.
0 commit comments