Skip to content
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

MODTLR-16: Create shadow requester in remote renant #14

Closed
wants to merge 3 commits into from

Conversation

OleksandrVidinieiev
Copy link
Contributor

@OleksandrVidinieiev OleksandrVidinieiev commented Feb 15, 2024

Purpose

Create shadow-copy of a requester in remote (target) tenant

Approach

  • check that requester exists in local (source) tenant, fail if it does not
  • check if requester's shadow-copy exists in remote (target) tenant
    • if it does, do nothing
    • if it does not, create it

TODOS and Open Questions

  • Use GitHub checklists. When solved, check the box and explain the answer.

Learning

Describe the research stage. Add links to blog posts, patterns, libraries or addons used to solve this problem.

Copy link

Comment on lines +39 to +56
tenantScopedExecutionService.execute(remoteTenantId, () -> {
try {
User existingShadowUser = usersClient.getUser(userId);
log.info("createShadowUser:: user {} found in remote tenant ({}), doing nothing",
userId, remoteTenantId);
log.debug("createShadowUser:: existing shadow user: {}", () -> existingShadowUser);
return null;
} catch (FeignException.NotFound e) {
log.info("createShadowUser:: user {} not found in remote tenant ({})", userId, remoteTenantId);
}
log.info("createShadowUser:: creating shadow user {} in remote tenant ({})", userId, remoteTenantId);
User newShadowUser = usersClient.postUser(buildShadowUser(realUser));
log.info("createShadowUser:: shadow user {} created in remote tenant ({})",
newShadowUser.getId(), remoteTenantId);
log.debug("createShadowUser:: created shadow user: {}", () -> newShadowUser);

return newShadowUser;
});
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about considering moving the lambda expression to a separate method?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants