New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Assign default roles from Teams to User #2947
Conversation
1cb5652
to
7f00f66
Compare
...og-rest-service/src/test/java/org/openmetadata/catalog/resources/teams/UserResourceTest.java
Outdated
Show resolved
Hide resolved
7f00f66
to
4390c43
Compare
4390c43
to
d4791c4
Compare
pytest failure due to connection issue
|
Hi @mithmatt, Thanks for the PR. Can you please take care of this test failure?
|
d4791c4
to
4ea354f
Compare
The Java checkstyle failed. Please run You can install the pre-commit hooks with |
b145216
to
1beb3ce
Compare
@@ -78,25 +79,19 @@ void defaultRole(TestInfo test) throws IOException { | |||
|
|||
List<User> users = new UserResourceTest().listEntities(Map.of("fields", "roles"), ADMIN_AUTH_HEADERS).getData(); | |||
for (User user : users) { | |||
boolean defaultRoleSet = false, prevDefaultRoleExists = false; | |||
|
|||
for (EntityReference role : user.getRoles()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Simplify the code - make it easy to understand
@@ -100,27 +101,90 @@ public void post_entity_as_non_admin_401(TestInfo test) { | |||
|
|||
@Order(Integer.MAX_VALUE) // Run this test last to avoid side effects of default role creation to fail other tests. | |||
@Test | |||
void post_userWithDefaultRole(TestInfo test) throws IOException { | |||
void userDefaultRoleAssignment(TestInfo test) throws IOException { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Making this a comprehensive behavioral test
if (rolesRef == null || rolesRef.isEmpty()) { | ||
rolesRef = new ArrayList<>(); | ||
// Add default roles from the teams that the user belongs to. | ||
List<EntityReference> teamsRef = Optional.ofNullable(user.getTeams()).orElse(Collections.emptyList()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the new logic being added
5f4a308
to
750666b
Compare
750666b
to
0db3cfe
Compare
[open-metadata-ingestion] Kudos, SonarCloud Quality Gate passed! |
[catalog] Kudos, SonarCloud Quality Gate passed! |
Describe your changes :
See #2883
Type of change :
Frontend Preview (Screenshots) :
For frontend related change, please link screenshots of your changes preview! Optional for backend related changes.
Checklist:
Reviewers
Backend: @sureshms @harshach