/** * Find matching enum * * @param privTypeStr * privilege type string * @param isGrant * @return * @throws HiveAuthzPluginException */ public static SQLPrivTypeGrant getSQLPrivTypeGrant(String privTypeStr, boolean isGrant) throws HiveAuthzPluginException { SQLPrivilegeType ptype = SQLPrivilegeType.getRequirePrivilege(privTypeStr); return getSQLPrivTypeGrant(ptype, isGrant); }
private List<HivePrivilege> expandAllPrivileges(List<HivePrivilege> hivePrivileges) { Set<HivePrivilege> hivePrivSet = new HashSet<HivePrivilege>(); for (HivePrivilege hivePrivilege : hivePrivileges) { if (hivePrivilege.getName().equals(ALL)) { // expand to all supported privileges for (SQLPrivilegeType privType : SQLPrivilegeType.values()) { hivePrivSet.add(new HivePrivilege(privType.name(), hivePrivilege.getColumns())); } } else { hivePrivSet.add(hivePrivilege); } } return new ArrayList<HivePrivilege>(hivePrivSet); }
SQLPrivTypeGrant(SQLPrivilegeType privType, boolean isGrant){ this.privType = privType; this.withGrant = isGrant; this.privDesc = privType.toString() + (withGrant ? " with grant" : ""); }
/** * Find matching enum * @param privType * @param isGrant * @return */ public static SQLPrivTypeGrant getSQLPrivTypeGrant( SQLPrivilegeType privType, boolean isGrant) { String typeName = privType.name() + (isGrant ? "_WGRANT" : "_NOGRANT"); return SQLPrivTypeGrant.valueOf(typeName); }
public static SQLPrivilegeType getRequirePrivilege(String priv) throws HiveAuthzPluginException { SQLPrivilegeType reqPriv; if(priv == null){ throw new HiveAuthzPluginException("Null privilege obtained"); } try { reqPriv = SQLPrivilegeType.valueOf(priv.toUpperCase(Locale.US)); } catch (IllegalArgumentException e) { throw new HiveAuthzPluginException("Unsupported privilege type " + priv, e); } return reqPriv; }
/** * Find matching enum * @param privType * @param isGrant * @return */ public static SQLPrivTypeGrant getSQLPrivTypeGrant( SQLPrivilegeType privType, boolean isGrant) { String typeName = privType.name() + (isGrant ? "_WGRANT" : "_NOGRANT"); return SQLPrivTypeGrant.valueOf(typeName); }
public static SQLPrivilegeType getRequirePrivilege(String priv) throws HiveAuthzPluginException { SQLPrivilegeType reqPriv; if(priv == null){ throw new HiveAuthzPluginException("Null privilege obtained"); } try { reqPriv = SQLPrivilegeType.valueOf(priv.toUpperCase(Locale.US)); } catch (IllegalArgumentException e) { throw new HiveAuthzPluginException("Unsupported privilege type " + priv, e); } return reqPriv; }
private List<HivePrivilege> expandAllPrivileges(List<HivePrivilege> hivePrivileges) { Set<HivePrivilege> hivePrivSet = new HashSet<HivePrivilege>(); for (HivePrivilege hivePrivilege : hivePrivileges) { if (hivePrivilege.getName().equals(ALL)) { // expand to all supported privileges for (SQLPrivilegeType privType : SQLPrivilegeType.values()) { hivePrivSet.add(new HivePrivilege(privType.name(), hivePrivilege.getColumns())); } } else { hivePrivSet.add(hivePrivilege); } } return new ArrayList<HivePrivilege>(hivePrivSet); }
/** * Find matching enum * * @param privTypeStr * privilege type string * @param isGrant * @return * @throws HiveAuthzPluginException */ public static SQLPrivTypeGrant getSQLPrivTypeGrant(String privTypeStr, boolean isGrant) throws HiveAuthzPluginException { SQLPrivilegeType ptype = SQLPrivilegeType.getRequirePrivilege(privTypeStr); return getSQLPrivTypeGrant(ptype, isGrant); }
/** * Find matching enum * @param privType * @param isGrant * @return */ public static SQLPrivTypeGrant getSQLPrivTypeGrant( SQLPrivilegeType privType, boolean isGrant) { String typeName = privType.name() + (isGrant ? "_WGRANT" : "_NOGRANT"); return SQLPrivTypeGrant.valueOf(typeName); }
SQLPrivTypeGrant(SQLPrivilegeType privType, boolean isGrant){ this.privType = privType; this.withGrant = isGrant; this.privDesc = privType.toString() + (withGrant ? " with grant" : ""); }
public static SQLPrivilegeType getRequirePrivilege(String priv) throws HiveAuthzPluginException { SQLPrivilegeType reqPriv; if(priv == null){ throw new HiveAuthzPluginException("Null privilege obtained"); } try { reqPriv = SQLPrivilegeType.valueOf(priv.toUpperCase(Locale.US)); } catch (IllegalArgumentException e) { throw new HiveAuthzPluginException("Unsupported privilege type " + priv, e); } return reqPriv; }
private List<HivePrivilege> expandAllPrivileges(List<HivePrivilege> hivePrivileges) { Set<HivePrivilege> hivePrivSet = new HashSet<HivePrivilege>(); for (HivePrivilege hivePrivilege : hivePrivileges) { if (hivePrivilege.getName().equals(ALL)) { // expand to all supported privileges for (SQLPrivilegeType privType : SQLPrivilegeType.values()) { hivePrivSet.add(new HivePrivilege(privType.name(), hivePrivilege.getColumns())); } } else { hivePrivSet.add(hivePrivilege); } } return new ArrayList<HivePrivilege>(hivePrivSet); }
/** * Check if the privileges are acceptable for SQL Standard authorization implementation * @param hivePrivileges * @throws HiveAuthzPluginException */ public static void validatePrivileges(List<HivePrivilege> hivePrivileges) throws HiveAuthzPluginException { for (HivePrivilege hivePrivilege : hivePrivileges) { if (hivePrivilege.getColumns() != null && hivePrivilege.getColumns().size() != 0) { throw new HiveAuthzPluginException( "Privilege with columns are not currently supported with sql standard authorization:" + hivePrivilege); } //try converting to the enum to verify that this is a valid privilege type SQLPrivilegeType.getRequirePrivilege(hivePrivilege.getName()); } }
SQLPrivTypeGrant(SQLPrivilegeType privType, boolean isGrant){ this.privType = privType; this.withGrant = isGrant; this.privDesc = privType.toString() + (withGrant ? " with grant" : ""); }
/** * Check if the privileges are acceptable for SQL Standard authorization implementation * @param hivePrivileges * @throws HiveAuthzPluginException */ public static void validatePrivileges(List<HivePrivilege> hivePrivileges) throws HiveAuthzPluginException { for (HivePrivilege hivePrivilege : hivePrivileges) { if (hivePrivilege.getColumns() != null && hivePrivilege.getColumns().size() != 0) { throw new HiveAuthzPluginException( "Privilege with columns are not currently supported with sql standard authorization:" + hivePrivilege); } //try converting to the enum to verify that this is a valid privilege type SQLPrivilegeType.getRequirePrivilege(hivePrivilege.getName()); } }
/** * Find matching enum * * @param privTypeStr * privilege type string * @param isGrant * @return * @throws HiveAuthzPluginException */ public static SQLPrivTypeGrant getSQLPrivTypeGrant(String privTypeStr, boolean isGrant) throws HiveAuthzPluginException { SQLPrivilegeType ptype = SQLPrivilegeType.getRequirePrivilege(privTypeStr); return getSQLPrivTypeGrant(ptype, isGrant); }
/** * Check if the privileges are acceptable for SQL Standard authorization implementation * @param hivePrivileges * @throws HiveAuthzPluginException */ public static void validatePrivileges(List<HivePrivilege> hivePrivileges) throws HiveAuthzPluginException { for (HivePrivilege hivePrivilege : hivePrivileges) { if (hivePrivilege.getColumns() != null && hivePrivilege.getColumns().size() != 0) { throw new HiveAuthzPluginException( "Privilege with columns are not currently supported with sql standard authorization:" + hivePrivilege); } //try converting to the enum to verify that this is a valid privilege type SQLPrivilegeType.getRequirePrivilege(hivePrivilege.getName()); } }