> On Sept. 22, 2020, 4 p.m., Madhan Neethiraj wrote: > > intg/src/main/java/org/apache/atlas/type/AtlasTypeRegistry.java > > Line 753 (original) > > <https://reviews.apache.org/r/72894/diff/1/?file=2239801#file2239801line753> > > > > I suggest to not remove this validation from here. BTW, has this > > validation been moved to else where?
validation is removed from here so that authorization can be done before the TYPE_ALREADY_EXISTS check and user who do not have read access do not know about this typedef. TYPE_ALREADY_EXISTS check is also done in preCreate method of AtlasClassificationDefStoreV2 which handle duplicate check. It also avaialble in precreate of AtlasEntityDefStoreV2 , AtlasEnumDefStoreV2 , AtlasRelationshipDefStoreV2, AtlasBusinessMetadataDefStoreV2, AtlasStructDefStoreV2 > On Sept. 22, 2020, 4 p.m., Madhan Neethiraj wrote: > > repository/src/main/java/org/apache/atlas/repository/store/graph/v2/AtlasClassificationDefStoreV2.java > > Lines 379 (patched) > > <https://reviews.apache.org/r/72894/diff/1/?file=2239802#file2239802line381> > > > > When multiple classifications are created in one REST call, > > typeRegistry.getTypeDefByName(typeName) will return null when typeName is > > one of the newly created type. For example: > > > > { > > "classificationDefs": [ > > { > > "name": "tagBase" > > }, > > { > > "name": "tagDerived", > > "superTypes": [ "typeBase" ] > > } > > ] > > } > > > > Please validate above. { "classificationDefs": [ { "name": "PII2_parent", "description": "PII2_parent", "superTypes": [], "attributeDefs": [], "entityTypes": [ "hdfs_path", "hive_table" ], "category": "CLASSIFICATION" }, { "name": "PII2_child", "description": "PII2_child", "superTypes": [ "PII2_parent" ], "attributeDefs": [], "entityTypes": [ "hdfs_path", "hive_table" ], "category": "CLASSIFICATION" } ], "entityDefs": [], "enumDefs": [], "structDefs": [] } Tested with above case for creating classfications. typeRegistry.getTypeDefByName("PII2_parent") return AtlasBaseTypeDef object correctly. also I have added null check for def object. - Nixon ----------------------------------------------------------- This is an automatically generated e-mail. To reply, visit: https://reviews.apache.org/r/72894/#review221921 ----------------------------------------------------------- On Sept. 23, 2020, 6:42 p.m., Nixon Rodrigues wrote: > > ----------------------------------------------------------- > This is an automatically generated e-mail. To reply, visit: > https://reviews.apache.org/r/72894/ > ----------------------------------------------------------- > > (Updated Sept. 23, 2020, 6:42 p.m.) > > > Review request for atlas, chaitali, Jayendra Parab, Madhan Neethiraj, Nikhil > Bonte, and Sarath Subramanian. > > > Bugs: ATLAS-3952 > https://issues.apache.org/jira/browse/ATLAS-3952 > > > Repository: atlas > > > Description > ------- > > This patch consist two fixes. > 1) Authorize Super And SubTypes and entityType for type-read access before > creating Classificationdef. > 2) Move create-type access check before duplicate "Given type _ already > exists" validation. > > > Diffs > ----- > > intg/src/main/java/org/apache/atlas/type/AtlasTypeRegistry.java 4a79b6fd5 > > repository/src/main/java/org/apache/atlas/repository/store/graph/v2/AtlasClassificationDefStoreV2.java > 9ffede4e3 > > > Diff: https://reviews.apache.org/r/72894/diff/2/ > > > Testing > ------- > > Tested creating classification while superTypes/ subTypes and entityType with > valid/invalid read-Type access. > Testing duplicate classification while valid/invalid create-type access. > > > Thanks, > > Nixon Rodrigues > >