Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Open Subsurface Data Universe Software
Platform
Security and Compliance
entitlements
Commits
f71e5dab
Commit
f71e5dab
authored
May 20, 2021
by
Mingyang Zhu
Browse files
Merge branch 'fix-group-domain-validation' into 'master'
fix the group domain validation condition bug See merge request
!79
parents
e5a34977
c43e91cb
Pipeline
#41312
failed with stages
in 17 minutes and 15 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
entitlements-v2-core/src/main/java/org/opengroup/osdu/entitlements/v2/service/AddMemberService.java
View file @
f71e5dab
...
...
@@ -67,7 +67,7 @@ public class AddMemberService {
}
private
EntityNode
createNewMemberNode
(
String
memberPrimaryId
,
String
memberDesId
,
String
partitionId
)
{
if
(!
memberPrimaryId
.
endsWith
(
config
.
getDomain
()))
{
if
(!
memberPrimaryId
.
endsWith
(
String
.
format
(
"@%s.%s"
,
partitionId
,
config
.
getDomain
()))
)
{
return
EntityNode
.
createMemberNodeForNewUser
(
memberDesId
,
partitionId
);
}
else
{
throw
new
AppException
(
HttpStatus
.
NOT_FOUND
.
value
(),
HttpStatus
.
NOT_FOUND
.
getReasonPhrase
(),
String
.
format
(
"Member group %s not found"
,
memberPrimaryId
));
...
...
entitlements-v2-core/src/test/java/org/opengroup/osdu/entitlements/v2/service/AddMemberServiceTests.java
View file @
f71e5dab
...
...
@@ -69,19 +69,19 @@ public class AddMemberServiceTests {
EntityNode
groupNode
=
EntityNode
.
builder
().
nodeId
(
"data.x@common.contoso.com"
).
name
(
"data.x"
)
.
type
(
NodeType
.
GROUP
).
dataPartitionId
(
"common"
).
build
();
EntityNode
requesterNode
=
EntityNode
.
builder
().
nodeId
(
"requesterid"
).
name
(
"requesterid"
).
type
(
NodeType
.
USER
).
dataPartitionId
(
"common"
).
build
();
when
(
retrieveGroupRepo
.
getEntityNode
(
"member@
xxx
.com"
,
"common"
)).
thenReturn
(
Optional
.
empty
());
when
(
retrieveGroupRepo
.
getEntityNode
(
"member@
contoso
.com"
,
"common"
)).
thenReturn
(
Optional
.
empty
());
when
(
retrieveGroupRepo
.
groupExistenceValidation
(
"data.x@common.contoso.com"
,
"common"
)).
thenReturn
(
groupNode
);
when
(
retrieveGroupRepo
.
getEntityNode
(
"requesterid"
,
"common"
)).
thenReturn
(
Optional
.
of
(
requesterNode
));
EntityNode
rootDataGroupNode
=
EntityNode
.
builder
().
nodeId
(
"users.data.root@common.contoso.com"
).
name
(
"users.data.root"
)
.
type
(
NodeType
.
GROUP
).
dataPartitionId
(
"common"
).
build
();
when
(
retrieveGroupRepo
.
groupExistenceValidation
(
"users.data.root@common.contoso.com"
,
"common"
)).
thenReturn
(
rootDataGroupNode
);
when
(
retrieveGroupRepo
.
hasDirectChild
(
rootDataGroupNode
,
ChildrenReference
.
createChildrenReference
(
requesterNode
,
Role
.
MEMBER
))).
thenReturn
(
Boolean
.
TRUE
);
EntityNode
memberNode
=
EntityNode
.
builder
().
nodeId
(
"member@
xxx
.com"
).
name
(
"member@
xxx
.com"
).
type
(
NodeType
.
USER
)
.
dataPartitionId
(
"common"
).
description
(
"member@
xxx
.com"
).
appIds
(
Collections
.
emptySet
()).
build
();
EntityNode
memberNode
=
EntityNode
.
builder
().
nodeId
(
"member@
contoso
.com"
).
name
(
"member@
contoso
.com"
).
type
(
NodeType
.
USER
)
.
dataPartitionId
(
"common"
).
description
(
"member@
contoso
.com"
).
appIds
(
Collections
.
emptySet
()).
build
();
ParentTreeDto
parentTreeDto
=
ParentTreeDto
.
builder
().
parentReferences
(
Collections
.
emptySet
()).
maxDepth
(
2
).
build
();
when
(
retrieveGroupRepo
.
loadAllParents
(
memberNode
)).
thenReturn
(
parentTreeDto
);
AddMemberDto
addMemberDto
=
new
AddMemberDto
(
"member@
xxx
.com"
,
Role
.
MEMBER
);
AddMemberDto
addMemberDto
=
new
AddMemberDto
(
"member@
contoso
.com"
,
Role
.
MEMBER
);
AddMemberServiceDto
addMemberServiceDto
=
AddMemberServiceDto
.
builder
()
.
groupEmail
(
"data.x@common.contoso.com"
)
.
requesterId
(
"requesterid"
)
...
...
Write
Preview
Supports
Markdown
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