Skip to content

Commit

Permalink
rename variable
Browse files Browse the repository at this point in the history
  • Loading branch information
xunliu committed Oct 18, 2024
1 parent a48fbaa commit 213f440
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -119,22 +119,22 @@ public List<RangerSecurableObject> translateOwner(MetadataObject metadataObject)
// Add `*` for the SCHEMA permission
rangerSecurableObjects.add(
RangerSecurableObjects.of(
ImmutableList.of(RangerHelper.RESOURCE_STAR),
ImmutableList.of(RangerHelper.RESOURCE_ALL),
MetadataObject.Type.SCHEMA,
ownerMappingRule()));
// Add `*.*` for the TABLE permission
rangerSecurableObjects.add(
RangerSecurableObjects.of(
ImmutableList.of(RangerHelper.RESOURCE_STAR, RangerHelper.RESOURCE_STAR),
ImmutableList.of(RangerHelper.RESOURCE_ALL, RangerHelper.RESOURCE_ALL),
MetadataObject.Type.TABLE,
ownerMappingRule()));
// Add `*.*.*` for the COLUMN permission
rangerSecurableObjects.add(
RangerSecurableObjects.of(
ImmutableList.of(
RangerHelper.RESOURCE_STAR,
RangerHelper.RESOURCE_STAR,
RangerHelper.RESOURCE_STAR),
RangerHelper.RESOURCE_ALL,
RangerHelper.RESOURCE_ALL,
RangerHelper.RESOURCE_ALL),
MetadataObject.Type.COLUMN,
ownerMappingRule()));
break;
Expand All @@ -148,16 +148,16 @@ public List<RangerSecurableObject> translateOwner(MetadataObject metadataObject)
// Add `{schema}.*` for the TABLE permission
rangerSecurableObjects.add(
RangerSecurableObjects.of(
ImmutableList.of(metadataObject.name() /*Schema name*/, RangerHelper.RESOURCE_STAR),
ImmutableList.of(metadataObject.name() /*Schema name*/, RangerHelper.RESOURCE_ALL),
MetadataObject.Type.TABLE,
ownerMappingRule()));
// Add `{schema}.*.*` for the COLUMN permission
rangerSecurableObjects.add(
RangerSecurableObjects.of(
ImmutableList.of(
metadataObject.name() /*Schema name*/,
RangerHelper.RESOURCE_STAR,
RangerHelper.RESOURCE_STAR),
RangerHelper.RESOURCE_ALL,
RangerHelper.RESOURCE_ALL),
MetadataObject.Type.COLUMN,
ownerMappingRule()));
break;
Expand All @@ -173,7 +173,7 @@ public List<RangerSecurableObject> translateOwner(MetadataObject metadataObject)
RangerSecurableObjects.of(
Stream.concat(
convertToRangerMetadataObject(metadataObject).stream(),
Stream.of(RangerHelper.RESOURCE_STAR))
Stream.of(RangerHelper.RESOURCE_ALL))
.collect(Collectors.toList()),
MetadataObject.Type.COLUMN,
ownerMappingRule()));
Expand Down Expand Up @@ -215,7 +215,7 @@ public List<RangerSecurableObject> translatePrivilege(SecurableObject securableO
// Add Ranger privilege(`SELECT`) to SCHEMA(`*`)
rangerSecurableObjects.add(
RangerSecurableObjects.of(
ImmutableList.of(RangerHelper.RESOURCE_STAR),
ImmutableList.of(RangerHelper.RESOURCE_ALL),
MetadataObject.Type.SCHEMA,
rangerPrivileges));
break;
Expand All @@ -232,7 +232,7 @@ public List<RangerSecurableObject> translatePrivilege(SecurableObject securableO
// Add Ranger privilege(`CREATE`) to SCHEMA(`*`)
rangerSecurableObjects.add(
RangerSecurableObjects.of(
ImmutableList.of(RangerHelper.RESOURCE_STAR),
ImmutableList.of(RangerHelper.RESOURCE_ALL),
MetadataObject.Type.SCHEMA,
rangerPrivileges));
break;
Expand All @@ -249,7 +249,7 @@ public List<RangerSecurableObject> translatePrivilege(SecurableObject securableO
// Add Ranger privilege(`SELECT`) to SCHEMA(`*`)
rangerSecurableObjects.add(
RangerSecurableObjects.of(
ImmutableList.of(RangerHelper.RESOURCE_STAR),
ImmutableList.of(RangerHelper.RESOURCE_ALL),
MetadataObject.Type.SCHEMA,
rangerPrivileges));
break;
Expand Down Expand Up @@ -277,16 +277,16 @@ public List<RangerSecurableObject> translatePrivilege(SecurableObject securableO
rangerSecurableObjects.add(
RangerSecurableObjects.of(
ImmutableList.of(
RangerHelper.RESOURCE_STAR, RangerHelper.RESOURCE_STAR),
RangerHelper.RESOURCE_ALL, RangerHelper.RESOURCE_ALL),
MetadataObject.Type.TABLE,
rangerPrivileges));
// Add `*.*.*` for the COLUMN permission
rangerSecurableObjects.add(
RangerSecurableObjects.of(
ImmutableList.of(
RangerHelper.RESOURCE_STAR,
RangerHelper.RESOURCE_STAR,
RangerHelper.RESOURCE_STAR),
RangerHelper.RESOURCE_ALL,
RangerHelper.RESOURCE_ALL,
RangerHelper.RESOURCE_ALL),
MetadataObject.Type.COLUMN,
rangerPrivileges));
break;
Expand All @@ -296,16 +296,16 @@ public List<RangerSecurableObject> translatePrivilege(SecurableObject securableO
RangerSecurableObjects.of(
ImmutableList.of(
securableObject.name() /*Schema name*/,
RangerHelper.RESOURCE_STAR),
RangerHelper.RESOURCE_ALL),
MetadataObject.Type.TABLE,
rangerPrivileges));
// Add `{schema}.*.*` for the COLUMN permission
rangerSecurableObjects.add(
RangerSecurableObjects.of(
ImmutableList.of(
securableObject.name() /*Schema name*/,
RangerHelper.RESOURCE_STAR,
RangerHelper.RESOURCE_STAR),
RangerHelper.RESOURCE_ALL,
RangerHelper.RESOURCE_ALL),
MetadataObject.Type.COLUMN,
rangerPrivileges));
break;
Expand All @@ -326,7 +326,7 @@ public List<RangerSecurableObject> translatePrivilege(SecurableObject securableO
RangerSecurableObjects.of(
Stream.concat(
convertToRangerMetadataObject(securableObject).stream(),
Stream.of(RangerHelper.RESOURCE_STAR))
Stream.of(RangerHelper.RESOURCE_ALL))
.collect(Collectors.toList()),
MetadataObject.Type.COLUMN,
rangerPrivileges));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ public class RangerHelper {
private static final Logger LOG = LoggerFactory.getLogger(RangerHelper.class);

public static final String MANAGED_BY_GRAVITINO = "MANAGED_BY_GRAVITINO";
public static final String RESOURCE_STAR = "*";
/** The `*` gives access to all resources */
public static final String RESOURCE_ALL = "*";
/** The owner privileges, the owner can do anything on the metadata object */
private final Set<RangerPrivilege> ownerPrivileges;
/** The policy search keys */
Expand Down

0 comments on commit 213f440

Please sign in to comment.