Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
atlas
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
dataplatform
atlas
Commits
06cd0cb3
Commit
06cd0cb3
authored
Jul 07, 2020
by
chaitali borole
Committed by
nixonrodrigues
Jul 09, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ATLAS-3855 :- Bulk entity tag association and bulk api enhancement, authorization fix.
Signed-off-by:
nixonrodrigues
<
nixon@apache.org
>
parent
682d16dd
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
56 additions
and
18 deletions
+56
-18
AtlasEntityStoreV2.java
...e/atlas/repository/store/graph/v2/AtlasEntityStoreV2.java
+45
-18
RequestContext.java
...er-api/src/main/java/org/apache/atlas/RequestContext.java
+9
-0
AuditFilter.java
...c/main/java/org/apache/atlas/web/filters/AuditFilter.java
+2
-0
No files found.
repository/src/main/java/org/apache/atlas/repository/store/graph/v2/AtlasEntityStoreV2.java
View file @
06cd0cb3
...
@@ -210,10 +210,24 @@ public class AtlasEntityStoreV2 implements AtlasEntityStore {
...
@@ -210,10 +210,24 @@ public class AtlasEntityStoreV2 implements AtlasEntityStore {
AtlasEntitiesWithExtInfo
ret
=
entityRetriever
.
toAtlasEntitiesWithExtInfo
(
guids
,
isMinExtInfo
);
AtlasEntitiesWithExtInfo
ret
=
entityRetriever
.
toAtlasEntitiesWithExtInfo
(
guids
,
isMinExtInfo
);
if
(
ret
!=
null
){
if
(
ret
!=
null
){
for
(
String
guid
:
guids
){
for
(
String
guid
:
guids
)
{
AtlasEntity
entity
=
ret
.
getEntity
(
guid
);
try
{
AtlasEntity
entity
=
ret
.
getEntity
(
guid
);
AtlasAuthorizationUtils
.
verifyAccess
(
new
AtlasEntityAccessRequest
(
typeRegistry
,
AtlasPrivilege
.
ENTITY_READ
,
new
AtlasEntityHeader
(
entity
)),
"read entity: guid="
,
guid
);
}
catch
(
AtlasBaseException
e
)
{
if
(
RequestContext
.
get
().
isSkipFailedEntities
())
{
if
(
LOG
.
isDebugEnabled
())
{
LOG
.
debug
(
"getByIds(): ignoring failure for entity {}: error code={}, message={}"
,
guid
,
e
.
getAtlasErrorCode
(),
e
.
getMessage
());
}
ret
.
removeEntity
(
guid
);
continue
;
}
AtlasAuthorizationUtils
.
verifyAccess
(
new
AtlasEntityAccessRequest
(
typeRegistry
,
AtlasPrivilege
.
ENTITY_READ
,
new
AtlasEntityHeader
(
entity
)),
"read entity: guid="
,
guid
);
throw
e
;
}
}
}
}
}
...
@@ -706,37 +720,50 @@ public class AtlasEntityStoreV2 implements AtlasEntityStore {
...
@@ -706,37 +720,50 @@ public class AtlasEntityStoreV2 implements AtlasEntityStore {
if
(
CollectionUtils
.
isEmpty
(
guids
))
{
if
(
CollectionUtils
.
isEmpty
(
guids
))
{
throw
new
AtlasBaseException
(
AtlasErrorCode
.
INVALID_PARAMETERS
,
"Guid(s) not specified"
);
throw
new
AtlasBaseException
(
AtlasErrorCode
.
INVALID_PARAMETERS
,
"Guid(s) not specified"
);
}
}
if
(
classification
==
null
)
{
if
(
classification
==
null
)
{
throw
new
AtlasBaseException
(
AtlasErrorCode
.
INVALID_PARAMETERS
,
"classification not specified"
);
throw
new
AtlasBaseException
(
AtlasErrorCode
.
INVALID_PARAMETERS
,
"classification not specified"
);
}
}
EntityMutationContext
context
=
new
EntityMutationContext
();
validateAndNormalize
(
classification
);
EntityMutationContext
context
=
new
EntityMutationContext
();
List
<
AtlasClassification
>
classifications
=
Collections
.
singletonList
(
classification
);
List
<
String
>
validGuids
=
new
ArrayList
<>();
GraphTransactionInterceptor
.
lockObjectAndReleasePostCommit
(
guids
);
GraphTransactionInterceptor
.
lockObjectAndReleasePostCommit
(
guids
);
for
(
String
guid
:
guids
)
{
for
(
String
guid
:
guids
)
{
AtlasVertex
entityVertex
=
AtlasGraphUtilsV2
.
findByGuid
(
graph
,
guid
);
try
{
AtlasVertex
entityVertex
=
AtlasGraphUtilsV2
.
findByGuid
(
graph
,
guid
);
if
(
entityVertex
==
null
)
{
if
(
entityVertex
==
null
)
{
throw
new
AtlasBaseException
(
AtlasErrorCode
.
INSTANCE_GUID_NOT_FOUND
,
guid
);
throw
new
AtlasBaseException
(
AtlasErrorCode
.
INSTANCE_GUID_NOT_FOUND
,
guid
);
}
}
AtlasEntityHeader
entityHeader
=
entityRetriever
.
toAtlasEntityHeaderWithClassifications
(
entityVertex
);
AtlasEntityHeader
entityHeader
=
entityRetriever
.
toAtlasEntityHeaderWithClassifications
(
entityVertex
);
AtlasAuthorizationUtils
.
verifyAccess
(
new
AtlasEntityAccessRequest
(
typeRegistry
,
AtlasPrivilege
.
ENTITY_ADD_CLASSIFICATION
,
entityHeader
,
classification
),
AtlasAuthorizationUtils
.
verifyAccess
(
new
AtlasEntityAccessRequest
(
typeRegistry
,
AtlasPrivilege
.
ENTITY_ADD_CLASSIFICATION
,
entityHeader
,
classification
),
"add classification: guid="
,
guid
,
", classification="
,
classification
.
getTypeName
());
"add classification: guid="
,
guid
,
", classification="
,
classification
.
getTypeName
());
context
.
cacheEntity
(
guid
,
entityVertex
,
typeRegistry
.
getEntityTypeByName
(
entityHeader
.
getTypeName
()));
validateEntityAssociations
(
guid
,
classifications
);
}
validGuids
.
add
(
guid
);
context
.
cacheEntity
(
guid
,
entityVertex
,
typeRegistry
.
getEntityTypeByName
(
entityHeader
.
getTypeName
()));
}
catch
(
AtlasBaseException
abe
)
{
if
(
RequestContext
.
get
().
isSkipFailedEntities
())
{
if
(
LOG
.
isDebugEnabled
())
{
LOG
.
debug
(
"addClassification(): ignoring failure for entity {}: error code={}, message={}"
,
guid
,
abe
.
getAtlasErrorCode
(),
abe
.
getMessage
());
}
validateAndNormalize
(
classification
);
continue
;
}
List
<
AtlasClassification
>
classifications
=
Collections
.
singletonList
(
classification
);
for
(
String
guid
:
guids
)
{
throw
abe
;
validateEntityAssociations
(
guid
,
classifications
);
}
}
for
(
String
guid
:
validGuids
)
{
entityGraphMapper
.
addClassifications
(
context
,
guid
,
classifications
);
entityGraphMapper
.
addClassifications
(
context
,
guid
,
classifications
);
}
}
}
}
...
...
server-api/src/main/java/org/apache/atlas/RequestContext.java
View file @
06cd0cb3
...
@@ -71,6 +71,7 @@ public class RequestContext {
...
@@ -71,6 +71,7 @@ public class RequestContext {
private
boolean
isInNotificationProcessing
=
false
;
private
boolean
isInNotificationProcessing
=
false
;
private
boolean
isInTypePatching
=
false
;
private
boolean
isInTypePatching
=
false
;
private
boolean
createShellEntityForNonExistingReference
=
false
;
private
boolean
createShellEntityForNonExistingReference
=
false
;
private
boolean
skipFailedEntities
=
false
;
private
RequestContext
()
{
private
RequestContext
()
{
}
}
...
@@ -208,6 +209,14 @@ public class RequestContext {
...
@@ -208,6 +209,14 @@ public class RequestContext {
this
.
createShellEntityForNonExistingReference
=
createShellEntityForNonExistingReference
;
this
.
createShellEntityForNonExistingReference
=
createShellEntityForNonExistingReference
;
}
}
public
boolean
isSkipFailedEntities
()
{
return
skipFailedEntities
;
}
public
void
setSkipFailedEntities
(
boolean
skipFailedEntities
)
{
this
.
skipFailedEntities
=
skipFailedEntities
;
}
public
void
recordEntityUpdate
(
AtlasEntityHeader
entity
)
{
public
void
recordEntityUpdate
(
AtlasEntityHeader
entity
)
{
if
(
entity
!=
null
&&
entity
.
getGuid
()
!=
null
&&
!
entitiesToSkipUpdate
.
contains
(
entity
.
getGuid
()))
{
if
(
entity
!=
null
&&
entity
.
getGuid
()
!=
null
&&
!
entitiesToSkipUpdate
.
contains
(
entity
.
getGuid
()))
{
updatedEntities
.
put
(
entity
.
getGuid
(),
entity
);
updatedEntities
.
put
(
entity
.
getGuid
(),
entity
);
...
...
webapp/src/main/java/org/apache/atlas/web/filters/AuditFilter.java
View file @
06cd0cb3
...
@@ -82,6 +82,7 @@ public class AuditFilter implements Filter {
...
@@ -82,6 +82,7 @@ public class AuditFilter implements Filter {
final
String
user
=
AtlasAuthorizationUtils
.
getCurrentUserName
();
final
String
user
=
AtlasAuthorizationUtils
.
getCurrentUserName
();
final
Set
<
String
>
userGroups
=
AtlasAuthorizationUtils
.
getCurrentUserGroups
();
final
Set
<
String
>
userGroups
=
AtlasAuthorizationUtils
.
getCurrentUserGroups
();
final
String
deleteType
=
httpRequest
.
getParameter
(
"deleteType"
);
final
String
deleteType
=
httpRequest
.
getParameter
(
"deleteType"
);
final
boolean
skipFailedEntities
=
Boolean
.
parseBoolean
(
httpRequest
.
getParameter
(
"skipFailedEntities"
));
try
{
try
{
currentThread
.
setName
(
formatName
(
oldName
,
requestId
));
currentThread
.
setName
(
formatName
(
oldName
,
requestId
));
...
@@ -92,6 +93,7 @@ public class AuditFilter implements Filter {
...
@@ -92,6 +93,7 @@ public class AuditFilter implements Filter {
requestContext
.
setClientIPAddress
(
AtlasAuthorizationUtils
.
getRequestIpAddress
(
httpRequest
));
requestContext
.
setClientIPAddress
(
AtlasAuthorizationUtils
.
getRequestIpAddress
(
httpRequest
));
requestContext
.
setCreateShellEntityForNonExistingReference
(
createShellEntityForNonExistingReference
);
requestContext
.
setCreateShellEntityForNonExistingReference
(
createShellEntityForNonExistingReference
);
requestContext
.
setForwardedAddresses
(
AtlasAuthorizationUtils
.
getForwardedAddressesFromRequest
(
httpRequest
));
requestContext
.
setForwardedAddresses
(
AtlasAuthorizationUtils
.
getForwardedAddressesFromRequest
(
httpRequest
));
requestContext
.
setSkipFailedEntities
(
skipFailedEntities
);
if
(
StringUtils
.
isNotEmpty
(
deleteType
))
{
if
(
StringUtils
.
isNotEmpty
(
deleteType
))
{
if
(
deleteTypeOverrideEnabled
)
{
if
(
deleteTypeOverrideEnabled
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment