Skip to content

Commit 25f90b1

Browse files
authored
Merge pull request #15 from ApplauseOSS/fix/workspaces-support
feat: update define managed resources and fix the revoke filter
2 parents f101dca + aca1c52 commit 25f90b1

1 file changed

Lines changed: 13 additions & 1 deletion

File tree

internal/role/role.go

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1262,12 +1262,24 @@ func (rp *RoleProcessor) syncRoleGrants(role Role) {
12621262
toAdd := difference(desired, current)
12631263
toRevoke := difference(current, desired)
12641264

1265-
// Filter out OWNERSHIP grants (cannot be revoked, only transferred)
1265+
// Only revoke grants for object types this tool explicitly manages.
1266+
// Leave ROLE grants and any other unmanaged types alone.
1267+
managedObjectTypes := map[string]struct{}{
1268+
"DATABASE": {},
1269+
"SCHEMA": {},
1270+
"TABLE": {},
1271+
"VIEW": {},
1272+
"WAREHOUSE": {},
1273+
"WORKSPACE": {},
1274+
}
12661275
filteredToRevoke := make(map[GrantKey]struct{})
12671276
for gk := range toRevoke {
12681277
if strings.ToUpper(gk.Privilege) == "OWNERSHIP" {
12691278
continue
12701279
}
1280+
if _, managed := managedObjectTypes[strings.ToUpper(gk.ObjectType)]; !managed {
1281+
continue
1282+
}
12711283
filteredToRevoke[gk] = struct{}{}
12721284
}
12731285
toRevoke = filteredToRevoke

0 commit comments

Comments
 (0)