Skip to content

Commit

Permalink
style
Browse files Browse the repository at this point in the history
  • Loading branch information
fdaugan committed May 9, 2024
1 parent 0fd818d commit 3e81069
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 51 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public abstract class AbstractOrgResource {
*
* @return User repository provider.
*/
protected IUserRepository getUser() {
public IUserRepository getUserRepository() {
return iamProvider[0].getConfiguration().getUserRepository();
}

Expand All @@ -44,7 +44,7 @@ protected IUserRepository getUser() {
*
* @return Company repository provider.
*/
protected ICompanyRepository getCompany() {
public ICompanyRepository getCompanyRepository() {
return iamProvider[0].getConfiguration().getCompanyRepository();
}

Expand All @@ -53,7 +53,7 @@ protected ICompanyRepository getCompany() {
*
* @return Group repository provider.
*/
protected IGroupRepository getGroup() {
public IGroupRepository getGroupRepository() {
return iamProvider[0].getConfiguration().getGroupRepository();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public CacheCompanyRepository getCacheRepository() {

@Override
public ICompanyRepository getRepository() {
return getCompany();
return getCompanyRepository();
}

/**
Expand All @@ -64,7 +64,7 @@ public ICompanyRepository getRepository() {
* @return The company name of current user or <code>null</code> if the current user is not in the repository.
*/
public CompanyOrg getUserCompany() {
final var user = getUser().findById(securityHelper.getLogin());
final var user = getUserRepository().findById(securityHelper.getLogin());
if (user == null) {
return null;
}
Expand All @@ -91,7 +91,7 @@ private String getUserCompanyDn() {
*/
public boolean isUserInternalCompany() {
return ObjectUtils.defaultIfNull(getUserCompanyDn(), "")
.endsWith(ObjectUtils.defaultIfNull(getUser().getPeopleInternalBaseDn(), ""));
.endsWith(ObjectUtils.defaultIfNull(getUserRepository().getPeopleInternalBaseDn(), ""));
}

/**
Expand All @@ -111,8 +111,8 @@ public TableItem<ContainerCountVo> findAll(@Context final UriInfo uriInfo) {
.collect(Collectors.toSet());
final var writeCompanies = getContainersIdForWrite();
final var adminCompanies = getContainersIdForAdmin();
final var users = getUser().findAll();
final var companies = getCompany().findAll();
final var users = getUserRepository().findAll();
final var companies = getCompanyRepository().findAll();

// Search the companies
final var findAll = getRepository().findAll(visibleCompanies,
Expand Down Expand Up @@ -142,7 +142,7 @@ protected void checkForDeletion(final ContainerOrg container) {
super.checkForDeletion(container);

// Company deletion is only possible where there is no user inside this company, or inside any sub-company
final var users = getUser().findAll();
final var users = getUserRepository().findAll();
if (getRepository().findAll().values().stream()
.filter(c -> DnUtils.equalsOrParentOf(container.getDn(), c.getDn()))
.anyMatch(c -> users.values().stream().map(UserOrg::getCompany).anyMatch(c.getId()::equals))) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public GroupResource() {

@Override
public IGroupRepository getRepository() {
return getGroup();
return getGroupRepository();
}

@Override
Expand All @@ -77,12 +77,12 @@ public CacheGroupRepository getCacheRepository() {
@GET
public TableItem<ContainerCountVo> findAll(@Context final UriInfo uriInfo) {
final var types = containerScopeResource.findAllDescOrder(ContainerType.GROUP);
final var companies = getCompany().findAll();
final var companies = getCompanyRepository().findAll();
final var visibleCompanies = organizationResource.getContainers();
final var writeGroups = getContainersIdForWrite();
final var adminGroups = getContainersIdForAdmin();
final var users = getUser().findAll();
final var groups = getGroup().findAll();
final var users = getUserRepository().findAll();
final var groups = getGroupRepository().findAll();

// Search the groups
final var page = getContainers(DataTableAttributes.getSearch(uriInfo),
Expand Down Expand Up @@ -137,7 +137,7 @@ protected String toDn(final GroupEditionVo container, final ContainerScope scope
* @return The corresponding DN.
*/
private List<String> toDn(final List<String> uids) {
return CollectionUtils.emptyIfNull(uids).stream().map(getUser()::findByIdExpected).map(UserOrg::getDn).toList();
return CollectionUtils.emptyIfNull(uids).stream().map(getUserRepository()::findByIdExpected).map(UserOrg::getDn).toList();
}

/**
Expand All @@ -158,7 +158,7 @@ public void empty(@PathParam("id") final String id) {
}

// Perform the update
getRepository().empty(container, getUser().findAll());
getRepository().empty(container, getUserRepository().findAll());
}

@Override
Expand Down
Loading

0 comments on commit 3e81069

Please sign in to comment.