public TListSentryRolesRequest deepCopy() { return new TListSentryRolesRequest(this); }
@Override public boolean equals(Object that) { if (that == null) return false; if (that instanceof TListSentryRolesRequest) return this.equals((TListSentryRolesRequest)that); return false; }
public Object getFieldValue(_Fields field) { switch (field) { case PROTOCOL_VERSION: return Integer.valueOf(getProtocol_version()); case REQUESTOR_USER_NAME: return getRequestorUserName(); case GROUP_NAME: return getGroupName(); } throw new IllegalStateException(); }
/** * Performs a deep copy on <i>other</i>. */ public TListSentryRolesRequest(TListSentryRolesRequest other) { __isset_bitfield = other.__isset_bitfield; this.protocol_version = other.protocol_version; if (other.isSetRequestorUserName()) { this.requestorUserName = other.requestorUserName; } if (other.isSetGroupName()) { this.groupName = other.groupName; } }
/** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */ public boolean isSet(_Fields field) { if (field == null) { throw new IllegalArgumentException(); } switch (field) { case PROTOCOL_VERSION: return isSetProtocol_version(); case REQUESTOR_USER_NAME: return isSetRequestorUserName(); case GROUP_NAME: return isSetGroupName(); } throw new IllegalStateException(); }
public void setFieldValue(_Fields field, Object value) { switch (field) { case PROTOCOL_VERSION: if (value == null) { unsetProtocol_version(); } else { setProtocol_version((Integer)value); } break; case REQUESTOR_USER_NAME: if (value == null) { unsetRequestorUserName(); } else { setRequestorUserName((String)value); } break; case GROUP_NAME: if (value == null) { unsetGroupName(); } else { setGroupName((String)value); } break; } }
/** * Gets sentry role objects for a given groupName using the Sentry service * @param requestorUserName : user on whose behalf the request is issued * @param groupName : groupName to look up ( if null returns all roles for all groups) * @return Set of thrift sentry role objects * @throws SentryUserException */ public synchronized Set<TSentryRole> listRolesByGroupName( String requestorUserName, String groupName) throws SentryUserException { TListSentryRolesRequest request = new TListSentryRolesRequest(); request.setProtocol_version(ThriftConstants.TSENTRY_SERVICE_VERSION_CURRENT); request.setRequestorUserName(requestorUserName); request.setGroupName(groupName); TListSentryRolesResponse response; try { response = client.list_sentry_roles_by_group(request); Status.throwIfNotOk(response.getStatus()); return response.getRoles(); } catch (TException e) { throw new SentryUserException(THRIFT_EXCEPTION_MESSAGE, e); } }
public void validate() throws org.apache.thrift.TException { // check for required fields if (!isSetProtocol_version()) { throw new org.apache.thrift.protocol.TProtocolException("Required field 'protocol_version' is unset! Struct:" + toString()); } if (!isSetRequestorUserName()) { throw new org.apache.thrift.protocol.TProtocolException("Required field 'requestorUserName' is unset! Struct:" + toString()); } // check for sub-struct validity }
@Override public void read(org.apache.thrift.protocol.TProtocol prot, list_sentry_roles_by_group_args struct) throws org.apache.thrift.TException { TTupleProtocol iprot = (TTupleProtocol) prot; BitSet incoming = iprot.readBitSet(1); if (incoming.get(0)) { struct.request = new TListSentryRolesRequest(); struct.request.read(iprot); struct.setRequestIsSet(true); } } }
public void write(org.apache.thrift.protocol.TProtocol oprot, TListSentryRolesRequest struct) throws org.apache.thrift.TException { struct.validate(); oprot.writeStructBegin(STRUCT_DESC); oprot.writeFieldBegin(PROTOCOL_VERSION_FIELD_DESC); oprot.writeI32(struct.protocol_version); oprot.writeFieldEnd(); if (struct.requestorUserName != null) { oprot.writeFieldBegin(REQUESTOR_USER_NAME_FIELD_DESC); oprot.writeString(struct.requestorUserName); oprot.writeFieldEnd(); } if (struct.groupName != null) { if (struct.isSetGroupName()) { oprot.writeFieldBegin(GROUP_NAME_FIELD_DESC); oprot.writeString(struct.groupName); oprot.writeFieldEnd(); } } oprot.writeFieldStop(); oprot.writeStructEnd(); }
@Override public String toString() { StringBuilder sb = new StringBuilder("TListSentryRolesRequest("); boolean first = true; sb.append("protocol_version:"); sb.append(this.protocol_version); first = false; if (!first) sb.append(", "); sb.append("requestorUserName:"); if (this.requestorUserName == null) { sb.append("null"); } else { sb.append(this.requestorUserName); } first = false; if (isSetGroupName()) { if (!first) sb.append(", "); sb.append("groupName:"); if (this.groupName == null) { sb.append("null"); } else { sb.append(this.groupName); } first = false; } sb.append(")"); return sb.toString(); }
private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException { try { // it doesn't seem like you should have to do this, but java serialization is wacky, and doesn't call the default constructor. __isset_bitfield = 0; read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in))); } catch (org.apache.thrift.TException te) { throw new java.io.IOException(te); } }
TListSentryRolesRequest typedOther = (TListSentryRolesRequest)other; lastComparison = Boolean.valueOf(isSetProtocol_version()).compareTo(typedOther.isSetProtocol_version()); if (lastComparison != 0) { return lastComparison; if (isSetProtocol_version()) { lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.protocol_version, typedOther.protocol_version); if (lastComparison != 0) { lastComparison = Boolean.valueOf(isSetRequestorUserName()).compareTo(typedOther.isSetRequestorUserName()); if (lastComparison != 0) { return lastComparison; if (isSetRequestorUserName()) { lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.requestorUserName, typedOther.requestorUserName); if (lastComparison != 0) { lastComparison = Boolean.valueOf(isSetGroupName()).compareTo(typedOther.isSetGroupName()); if (lastComparison != 0) { return lastComparison; if (isSetGroupName()) { lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.groupName, typedOther.groupName); if (lastComparison != 0) {
public boolean equals(TListSentryRolesRequest that) { if (that == null) return false; boolean this_present_protocol_version = true; boolean that_present_protocol_version = true; if (this_present_protocol_version || that_present_protocol_version) { if (!(this_present_protocol_version && that_present_protocol_version)) return false; if (this.protocol_version != that.protocol_version) return false; } boolean this_present_requestorUserName = true && this.isSetRequestorUserName(); boolean that_present_requestorUserName = true && that.isSetRequestorUserName(); if (this_present_requestorUserName || that_present_requestorUserName) { if (!(this_present_requestorUserName && that_present_requestorUserName)) return false; if (!this.requestorUserName.equals(that.requestorUserName)) return false; } boolean this_present_groupName = true && this.isSetGroupName(); boolean that_present_groupName = true && that.isSetGroupName(); if (this_present_groupName || that_present_groupName) { if (!(this_present_groupName && that_present_groupName)) return false; if (!this.groupName.equals(that.groupName)) return false; } return true; }
public void read(org.apache.thrift.protocol.TProtocol iprot, list_sentry_roles_by_group_args struct) throws org.apache.thrift.TException { org.apache.thrift.protocol.TField schemeField; iprot.readStructBegin(); while (true) { schemeField = iprot.readFieldBegin(); if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { break; } switch (schemeField.id) { case 1: // REQUEST if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { struct.request = new TListSentryRolesRequest(); struct.request.read(iprot); struct.setRequestIsSet(true); } else { org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; default: org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } iprot.readFieldEnd(); } iprot.readStructEnd(); struct.validate(); }
@Override public void write(org.apache.thrift.protocol.TProtocol prot, TListSentryRolesRequest struct) throws org.apache.thrift.TException { TTupleProtocol oprot = (TTupleProtocol) prot; oprot.writeI32(struct.protocol_version); oprot.writeString(struct.requestorUserName); BitSet optionals = new BitSet(); if (struct.isSetGroupName()) { optionals.set(0); } oprot.writeBitSet(optionals, 1); if (struct.isSetGroupName()) { oprot.writeString(struct.groupName); } }
TSentryResponseStatus status; Set<TSentryRole> roleSet = new HashSet<TSentryRole>(); String subject = request.getRequestorUserName(); boolean checkAllGroups = false; try { validateClientVersion(request.getProtocol_version()); Set<String> groups = getRequestorGroups(subject); if (AccessConstants.ALL.equalsIgnoreCase(request.getGroupName())) { checkAllGroups = true; } else { if(!admin && (request.getGroupName() == null || !groups.contains(request.getGroupName()))) { throw new SentryAccessDeniedException("Access denied to " + subject); }else { groups.clear(); groups.add(request.getGroupName());
@Override public int hashCode() { HashCodeBuilder builder = new HashCodeBuilder(); boolean present_protocol_version = true; builder.append(present_protocol_version); if (present_protocol_version) builder.append(protocol_version); boolean present_requestorUserName = true && (isSetRequestorUserName()); builder.append(present_requestorUserName); if (present_requestorUserName) builder.append(requestorUserName); boolean present_groupName = true && (isSetGroupName()); builder.append(present_groupName); if (present_groupName) builder.append(groupName); return builder.toHashCode(); }
public boolean equals(list_sentry_roles_by_group_args that) { if (that == null) return false; boolean this_present_request = true && this.isSetRequest(); boolean that_present_request = true && that.isSetRequest(); if (this_present_request || that_present_request) { if (!(this_present_request && that_present_request)) return false; if (!this.request.equals(that.request)) return false; } return true; }
/** * Performs a deep copy on <i>other</i>. */ public list_sentry_roles_by_group_args(list_sentry_roles_by_group_args other) { if (other.isSetRequest()) { this.request = new TListSentryRolesRequest(other.request); } }