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
b03c2484
Commit
b03c2484
authored
6 years ago
by
nixonrodrigues
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ATLAS-2587:- Set read ACL for /apache_atlas/active_server_info znode in HA for Knox proxy to read.
parent
d5540595
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
4 deletions
+18
-4
ActiveInstanceState.java
...ava/org/apache/atlas/web/service/ActiveInstanceState.java
+15
-3
ActiveInstanceStateTest.java
...org/apache/atlas/web/service/ActiveInstanceStateTest.java
+3
-1
No files found.
webapp/src/main/java/org/apache/atlas/web/service/ActiveInstanceState.java
View file @
b03c2484
...
...
@@ -24,11 +24,13 @@ import org.apache.atlas.AtlasException;
import
org.apache.atlas.exception.AtlasBaseException
;
import
org.apache.atlas.ha.HAConfiguration
;
import
org.apache.commons.configuration.Configuration
;
import
org.apache.commons.lang.StringUtils
;
import
org.apache.curator.framework.CuratorFramework
;
import
org.apache.curator.framework.recipes.locks.InterProcessReadWriteLock
;
import
org.apache.zookeeper.CreateMode
;
import
org.apache.zookeeper.ZooDefs
;
import
org.apache.zookeeper.data.ACL
;
import
org.apache.zookeeper.data.Id
;
import
org.apache.zookeeper.data.Stat
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
...
...
@@ -37,6 +39,7 @@ import org.springframework.stereotype.Component;
import
javax.inject.Inject
;
import
java.nio.charset.Charset
;
import
java.util.Arrays
;
import
java.util.ArrayList
;
import
java.util.List
;
/**
...
...
@@ -91,9 +94,18 @@ public class ActiveInstanceState {
HAConfiguration
.
ZookeeperProperties
zookeeperProperties
=
HAConfiguration
.
getZookeeperProperties
(
configuration
);
String
atlasServerAddress
=
HAConfiguration
.
getBoundAddressForId
(
configuration
,
serverId
);
List
<
ACL
>
acls
=
Arrays
.
asList
(
new
ACL
[]{
AtlasZookeeperSecurityProperties
.
parseAcl
(
zookeeperProperties
.
getAcl
(),
ZooDefs
.
Ids
.
OPEN_ACL_UNSAFE
.
get
(
0
))});
List
<
ACL
>
acls
=
new
ArrayList
<
ACL
>();
ACL
parsedACL
=
AtlasZookeeperSecurityProperties
.
parseAcl
(
zookeeperProperties
.
getAcl
(),
ZooDefs
.
Ids
.
OPEN_ACL_UNSAFE
.
get
(
0
));
acls
.
add
(
parsedACL
);
//adding world read permission
if
(
StringUtils
.
isNotEmpty
(
zookeeperProperties
.
getAcl
()))
{
ACL
worldReadPermissionACL
=
new
ACL
(
ZooDefs
.
Perms
.
READ
,
new
Id
(
"world"
,
"anyone"
));
acls
.
add
(
worldReadPermissionACL
);
}
Stat
serverInfo
=
client
.
checkExists
().
forPath
(
getZnodePath
(
zookeeperProperties
));
if
(
serverInfo
==
null
)
{
client
.
create
().
...
...
This diff is collapsed.
Click to expand it.
webapp/src/test/java/org/apache/atlas/web/service/ActiveInstanceStateTest.java
View file @
b03c2484
...
...
@@ -115,8 +115,10 @@ public class ActiveInstanceStateTest {
when
(
curatorFramework
.
create
()).
thenReturn
(
createBuilder
);
when
(
createBuilder
.
withMode
(
CreateMode
.
EPHEMERAL
)).
thenReturn
(
createBuilder
);
ACL
expectedAcl
=
new
ACL
(
ZooDefs
.
Perms
.
ALL
,
new
Id
(
"sasl"
,
"myclient@EXAMPLE.COM"
));
ACL
expectedAcl1
=
new
ACL
(
ZooDefs
.
Perms
.
READ
,
new
Id
(
"world"
,
"anyone"
));
when
(
createBuilder
.
withACL
(
Arrays
.
asList
(
new
ACL
[]{
expectedAcl
}))).
thenReturn
(
createBuilder
);
withACL
(
Arrays
.
asList
(
new
ACL
[]{
expectedAcl
,
expectedAcl1
}))).
thenReturn
(
createBuilder
);
SetDataBuilder
setDataBuilder
=
mock
(
SetDataBuilder
.
class
);
when
(
curatorFramework
.
setData
()).
thenReturn
(
setDataBuilder
);
...
...
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