public TSentryActiveRoleSet deepCopy() { return new TSentryActiveRoleSet(this); }
@Override public boolean equals(Object that) { if (that == null) return false; if (that instanceof TSentryActiveRoleSet) return this.equals((TSentryActiveRoleSet)that); return false; }
public void setFieldValue(_Fields field, Object value) { switch (field) { case ALL: if (value == null) { unsetAll(); } else { setAll((Boolean)value); } break; case ROLES: if (value == null) { unsetRoles(); } else { setRoles((Set<String>)value); } break; } }
/** 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 ALL: return isSetAll(); case ROLES: return isSetRoles(); } throw new IllegalStateException(); }
case 3: // ROLE_SET if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { struct.roleSet = new TSentryActiveRoleSet(); struct.roleSet.read(iprot); struct.setRoleSetIsSet(true); } else {
throws Exception { Map<String, Set<TSentryPrivilege>> resultPrivilegeMap = Maps.newTreeMap(); Set<String> roles = getRolesToQuery(groups, null, new TSentryActiveRoleSet(true, null)); if (activeRoles != null && !activeRoles.isAll()) { for (String aRole : activeRoles.getRoles()) { roles.add(aRole.toLowerCase());
public void validate() throws org.apache.thrift.TException { // check for required fields if (!isSetAll()) { throw new org.apache.thrift.protocol.TProtocolException("Required field 'all' is unset! Struct:" + toString()); } if (!isSetRoles()) { throw new org.apache.thrift.protocol.TProtocolException("Required field 'roles' is unset! Struct:" + toString()); } // check for sub-struct validity }
if (schemeField.type == org.apache.thrift.protocol.TType.BOOL) { struct.all = iprot.readBool(); struct.setAllIsSet(true); } else { org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); struct.setRolesIsSet(true); } else { org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); struct.validate();
@Override public void read(org.apache.thrift.protocol.TProtocol prot, TSentryActiveRoleSet struct) throws org.apache.thrift.TException { TTupleProtocol iprot = (TTupleProtocol) prot; struct.all = iprot.readBool(); struct.setAllIsSet(true); { org.apache.thrift.protocol.TSet _set85 = new org.apache.thrift.protocol.TSet(org.apache.thrift.protocol.TType.STRING, iprot.readI32()); struct.roles = new HashSet<String>(2*_set85.size); String _elem86; for (int _i87 = 0; _i87 < _set85.size; ++_i87) { _elem86 = iprot.readString(); struct.roles.add(_elem86); } } struct.setRolesIsSet(true); } }
public void setAll(boolean all) { this.all = all; setAllIsSet(true); }
/** * Performs a deep copy on <i>other</i>. */ public TSentryActiveRoleSet(TSentryActiveRoleSet other) { __isset_bitfield = other.__isset_bitfield; this.all = other.all; if (other.isSetRoles()) { Set<String> __this__roles = new HashSet<String>(other.roles); this.roles = __this__roles; } }
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); } }
case 5: // ROLE_SET if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { struct.roleSet = new TSentryActiveRoleSet(); struct.roleSet.read(iprot); struct.setRoleSetIsSet(true); } else {
@Override public int compareTo(TSentryActiveRoleSet other) { if (!getClass().equals(other.getClass())) { return getClass().getName().compareTo(other.getClass().getName()); } int lastComparison = 0; lastComparison = Boolean.valueOf(isSetAll()).compareTo(other.isSetAll()); if (lastComparison != 0) { return lastComparison; } if (isSetAll()) { lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.all, other.all); if (lastComparison != 0) { return lastComparison; } } lastComparison = Boolean.valueOf(isSetRoles()).compareTo(other.isSetRoles()); if (lastComparison != 0) { return lastComparison; } if (isSetRoles()) { lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.roles, other.roles); if (lastComparison != 0) { return lastComparison; } } return 0; }
public TSentryActiveRoleSet( boolean all, Set<String> roles) { this(); this.all = all; setAllIsSet(true); this.roles = roles; }
public boolean equals(TSentryActiveRoleSet that) { if (that == null) return false; boolean this_present_all = true; boolean that_present_all = true; if (this_present_all || that_present_all) { if (!(this_present_all && that_present_all)) return false; if (this.all != that.all) return false; } boolean this_present_roles = true && this.isSetRoles(); boolean that_present_roles = true && that.isSetRoles(); if (this_present_roles || that_present_roles) { if (!(this_present_roles && that_present_roles)) return false; if (!this.roles.equals(that.roles)) return false; } return true; }
/** * Performs a deep copy on <i>other</i>. */ public TListSentryPrivilegesForProviderRequest(TListSentryPrivilegesForProviderRequest other) { __isset_bitfield = other.__isset_bitfield; this.protocol_version = other.protocol_version; if (other.isSetGroups()) { Set<String> __this__groups = new HashSet<String>(other.groups); this.groups = __this__groups; } if (other.isSetRoleSet()) { this.roleSet = new TSentryActiveRoleSet(other.roleSet); } if (other.isSetAuthorizableHierarchy()) { this.authorizableHierarchy = new TSentryAuthorizable(other.authorizableHierarchy); } if (other.isSetUsers()) { Set<String> __this__users = new HashSet<String>(other.users); this.users = __this__users; } }
struct.roleSet = new TSentryActiveRoleSet(); struct.roleSet.read(iprot); struct.setRoleSetIsSet(true); BitSet incoming = iprot.readBitSet(2);
private Set<String> getRolesToQuery(final Set<String> groups, final Set<String> users, final TSentryActiveRoleSet roleSet) throws Exception { return tm.executeTransaction( pm -> { pm.setDetachAllOnCommit(false); // No need to detach objects Set<String> activeRoleNames = toTrimedLower(roleSet.getRoles()); Set<String> roleNames = Sets.newHashSet(); roleNames.addAll(toTrimedLower(getRoleNamesForGroupsCore(pm, groups))); roleNames.addAll(toTrimedLower(getRoleNamesForUsersCore(pm, users))); return roleSet.isAll() ? roleNames : Sets.intersection(activeRoleNames, roleNames); }); }