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
4 years ago
by
chaitali borole
Committed by
nixonrodrigues
4 years ago
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 {
AtlasEntitiesWithExtInfo
ret
=
entityRetriever
.
toAtlasEntitiesWithExtInfo
(
guids
,
isMinExtInfo
);
if
(
ret
!=
null
){
for
(
String
guid
:
guids
){
AtlasEntity
entity
=
ret
.
getEntity
(
guid
);
for
(
String
guid
:
guids
)
{
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 {
if
(
CollectionUtils
.
isEmpty
(
guids
))
{
throw
new
AtlasBaseException
(
AtlasErrorCode
.
INVALID_PARAMETERS
,
"Guid(s) not specified"
);
}
if
(
classification
==
null
)
{
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
);
for
(
String
guid
:
guids
)
{
AtlasVertex
entityVertex
=
AtlasGraphUtilsV2
.
findByGuid
(
graph
,
guid
);
try
{
AtlasVertex
entityVertex
=
AtlasGraphUtilsV2
.
findByGuid
(
graph
,
guid
);
if
(
entityVertex
==
null
)
{
throw
new
AtlasBaseException
(
AtlasErrorCode
.
INSTANCE_GUID_NOT_FOUND
,
guid
);
}
if
(
entityVertex
==
null
)
{
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
),
"add classification: guid="
,
guid
,
", classification="
,
classification
.
getTypeName
());
AtlasAuthorizationUtils
.
verifyAccess
(
new
AtlasEntityAccessRequest
(
typeRegistry
,
AtlasPrivilege
.
ENTITY_ADD_CLASSIFICATION
,
entityHeader
,
classification
),
"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
);
List
<
AtlasClassification
>
classifications
=
Collections
.
singletonList
(
classification
);
continue
;
}
for
(
String
guid
:
guids
)
{
validateEntityAssociations
(
guid
,
classifications
);
throw
abe
;
}
}
for
(
String
guid
:
validGuids
)
{
entityGraphMapper
.
addClassifications
(
context
,
guid
,
classifications
);
}
}
...
...
This diff is collapsed.
Click to expand it.
server-api/src/main/java/org/apache/atlas/RequestContext.java
View file @
06cd0cb3
...
...
@@ -71,6 +71,7 @@ public class RequestContext {
private
boolean
isInNotificationProcessing
=
false
;
private
boolean
isInTypePatching
=
false
;
private
boolean
createShellEntityForNonExistingReference
=
false
;
private
boolean
skipFailedEntities
=
false
;
private
RequestContext
()
{
}
...
...
@@ -208,6 +209,14 @@ public class RequestContext {
this
.
createShellEntityForNonExistingReference
=
createShellEntityForNonExistingReference
;
}
public
boolean
isSkipFailedEntities
()
{
return
skipFailedEntities
;
}
public
void
setSkipFailedEntities
(
boolean
skipFailedEntities
)
{
this
.
skipFailedEntities
=
skipFailedEntities
;
}
public
void
recordEntityUpdate
(
AtlasEntityHeader
entity
)
{
if
(
entity
!=
null
&&
entity
.
getGuid
()
!=
null
&&
!
entitiesToSkipUpdate
.
contains
(
entity
.
getGuid
()))
{
updatedEntities
.
put
(
entity
.
getGuid
(),
entity
);
...
...
This diff is collapsed.
Click to expand it.
webapp/src/main/java/org/apache/atlas/web/filters/AuditFilter.java
View file @
06cd0cb3
...
...
@@ -82,6 +82,7 @@ public class AuditFilter implements Filter {
final
String
user
=
AtlasAuthorizationUtils
.
getCurrentUserName
();
final
Set
<
String
>
userGroups
=
AtlasAuthorizationUtils
.
getCurrentUserGroups
();
final
String
deleteType
=
httpRequest
.
getParameter
(
"deleteType"
);
final
boolean
skipFailedEntities
=
Boolean
.
parseBoolean
(
httpRequest
.
getParameter
(
"skipFailedEntities"
));
try
{
currentThread
.
setName
(
formatName
(
oldName
,
requestId
));
...
...
@@ -92,6 +93,7 @@ public class AuditFilter implements Filter {
requestContext
.
setClientIPAddress
(
AtlasAuthorizationUtils
.
getRequestIpAddress
(
httpRequest
));
requestContext
.
setCreateShellEntityForNonExistingReference
(
createShellEntityForNonExistingReference
);
requestContext
.
setForwardedAddresses
(
AtlasAuthorizationUtils
.
getForwardedAddressesFromRequest
(
httpRequest
));
requestContext
.
setSkipFailedEntities
(
skipFailedEntities
);
if
(
StringUtils
.
isNotEmpty
(
deleteType
))
{
if
(
deleteTypeOverrideEnabled
)
{
...
...
This diff is collapsed.
Click to expand it.
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