Skip to content

Commit

Permalink
Bump plugin-api to 4.1.6
Browse files Browse the repository at this point in the history
  • Loading branch information
fdaugan committed Feb 27, 2024
1 parent 69d280a commit 6fffd29
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 17 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,16 @@ jobs:
name: Build and analyze
runs-on: ubuntu-latest
steps:
- uses: s4u/setup-maven-action@v1.10.0
- uses: s4u/setup-maven-action@v1.12.0
with:
checkout-fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
java-version: 21
java-distribution: 'corretto'
cache-path-add: ~/.sonar/cache
cache-prefix: ${{ runner.os }}-sonar
maven-version: 3.9.4
maven-version: 3.9.6
- name: maven-settings-xml-action
uses: whelk-io/maven-settings-xml-action@v21
uses: whelk-io/maven-settings-xml-action@v22
with:
repositories: '[
{ "id": "spring-milestone", "url": "https://repo.spring.io/milestone/"},
Expand Down
12 changes: 1 addition & 11 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>org.ligoj.api</groupId>
<artifactId>plugin-parent</artifactId>
<version>4.1.5</version>
<version>4.1.6</version>
<relativePath />
</parent>

Expand All @@ -22,16 +22,6 @@
<url>https://github.com/ligoj/plugin-id.git</url>
</scm>

<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.ligoj.bootstrap</groupId>
<artifactId>bootstrap-business</artifactId>
<version>3.1.13</version>
</dependency>
</dependencies>
</dependencyManagement>

<profiles>
<profile>
<id>github</id>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ public TableItem<UserOrgVo> findAll(@QueryParam(SimpleUser.COMPANY_ALIAS) final
final var findAll = findAllNotSecure(visibleGroups, company, group, criteria, uriInfo);

// Apply pagination and secure the users data
return paginationJson.applyPagination(uriInfo, findAll, rawUserOrg -> {
final var result = paginationJson.applyPagination(uriInfo, findAll, rawUserOrg -> {

final var securedUserOrg = new UserOrgVo();
rawUserOrg.copy(securedUserOrg);
Expand All @@ -181,6 +181,11 @@ public TableItem<UserOrgVo> findAll(@QueryParam(SimpleUser.COMPANY_ALIAS) final
}).toList());
return securedUserOrg;
});

// Forward custom attributes definition
result.setExtensions(Map.of("customAttributes", getUser().getCustomAttributes()));

return result;
}

/**
Expand Down Expand Up @@ -508,11 +513,21 @@ protected boolean canWrite(final DelegateOrg delegate, final String dn, final De
return (delegate.getType() == type || delegate.getType() == DelegateType.TREE) && delegate.isCanWrite() && DnUtils.equalsOrParentOf(delegate.getDn(), dn);
}

private String mapToString(Map<String, String> map) {
if (map == null) {
return "";
}
return map.entrySet().stream().sorted(Map.Entry.comparingByKey()).map(Object::toString).collect(Collectors.joining());
}

/**
* Indicate the two user details have attribute differences
* Indicates the two user details have attribute differences.
*/
private boolean hasAttributeChange(final UserOrgEditionVo importEntry, final UserOrg userOrg) {
return hasAttributeChange(importEntry, userOrg == null, "new") || hasAttributeChange(importEntry, userOrg, SimpleUser::getFirstName, SimpleUser::getLastName, SimpleUser::getCompany, SimpleUser::getLocalId, SimpleUser::getDepartment) || hasAttributeChange(importEntry, !userOrg.getMails().contains(importEntry.getMail()), "mail");
return hasAttributeChange(importEntry, userOrg == null, "new")
|| hasAttributeChange(importEntry, userOrg, SimpleUser::getFirstName, SimpleUser::getLastName, SimpleUser::getCompany, SimpleUser::getLocalId, SimpleUser::getDepartment)
|| hasAttributeChange(importEntry, !mapToString(importEntry.getCustomAttributes()).equals(mapToString(userOrg.getCustomAttributes()) ), "customAttributes")
|| hasAttributeChange(importEntry, !userOrg.getMails().contains(importEntry.getMail()), "mail");
}

private boolean hasAttributeChange(final SimpleUser importEntry, boolean hasChange, String source) {
Expand Down

0 comments on commit 6fffd29

Please sign in to comment.