Skip to content

Commit 3a2e9e0

Browse files
committed
Merge dev into new-v7
2 parents 667e9f5 + 125bb9a commit 3a2e9e0

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+662
-193
lines changed

Diff for: CHANGELOG.md

+108
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,111 @@
1+
## 6.1.4 (2023-06-23)
2+
3+
#### Features
4+
5+
* Preserve grid scroll position on form save/reload
6+
7+
#### Fixed
8+
9+
* Fix buttons actions in Tree views
10+
* Fix on how application and module are determinate during gradle resolution
11+
12+
<details>
13+
14+
Due to the merge of `com.axelor.app` and `com.axelor.app-module` gradle
15+
plugins, it is now hard to determinate who is the module from the
16+
application. A module can be built itself, so it is seen as an
17+
application (when checking `project == project.getRootProject()`) and
18+
wrong plugins/dependencies/tasks are applied.
19+
20+
To overcomes this, when a module need to be built standalone,
21+
`axelor.application = false` property can be added in `gradle.properties`.
22+
This way, it will be seen as a module instead of an application.
23+
24+
Better support will be added in a future version.
25+
26+
</details>
27+
28+
* Fix going into edit mode in editable grid when clicking readonly cell
29+
* Fix selection widget stealing focus after focusing another cell
30+
* Readonly fields, included dot fields, shouldn't be focusable
31+
* Fix search request when adjusting page boundary
32+
* Fix onChange on Enter key in simple fields
33+
* Fix lost dotted fields in grid when using master-detail widget
34+
* Fix editable grid that don't wait for pending actions
35+
* Fix deselected row after save triggered by previous row in editable grid
36+
* Fix search box show/hide on cards view dashlet depending on dashlet `canSearch` attribute
37+
* Fix onNew action on editor
38+
* Don't create webapp folder in war
39+
* Fix toolbar buttons display when same grid is displayed multiple times
40+
41+
#### Security
42+
43+
* Check for unauthorized users inside security filter directly
44+
45+
## 6.1.3 (2023-05-15)
46+
47+
#### Fixed
48+
49+
* Align script helper test expressions with Action behavior
50+
* Fix attributes that need a test instead of an evaluation
51+
* Fix action test condition when context proxy is used
52+
* Do not try to generate binary download link on unsaved record
53+
54+
## 6.1.2 (2023-04-05)
55+
56+
#### Changes
57+
58+
* Improve resolution of AOP core dependencies
59+
60+
<details>
61+
62+
Use AOP version defined in root project. This avoids to use a version
63+
coming from transitive dependencies.
64+
65+
For example, if a module is built and published using AOP version 6.1.2
66+
and the root project use AOP version 6.1.1, it will now use the AOP
67+
version of the project, ie 6.1.1 (instead of getting the AOP version of
68+
the transitive dependency of the module).
69+
70+
</details>
71+
72+
#### Fixed
73+
74+
* Don't reload dashlet custom view when the widget is not visible
75+
* Disable exporting on Kanban views
76+
* Fix empty recipients list when posting message or adding followers
77+
* Fix onChange triggered after grid edit cancel
78+
* Fix missing "refresh", "new", "prev", and "next" keyboard shortcuts on cards and kanban views
79+
* Fix moving record on top level grid
80+
* Fix grid not editable depending on readonly/canEdit conditions
81+
* Fix redefined User namecolumn in collaboration widget
82+
83+
<details>
84+
85+
When the namecolumn of the User entity is redefined,
86+
it was not taken into account in the collaboration widget.
87+
88+
</details>
89+
90+
* Fix editable grid preventing save
91+
92+
<details>
93+
94+
On slow network and/or big grids, going in and out of grid edit
95+
may trigger duplicate grid edit events and mess with the counting
96+
of active editable grids. This could cause saving to fail.
97+
98+
</details>
99+
100+
* Fix export on relational fields
101+
* Fix spinner buttons triggering onChange inside editable grid
102+
* Escape data when generating xml
103+
* Don't allow to post message without body
104+
105+
#### Security
106+
107+
* Check `canNew` view attribute with "create new record" keyboard shortcut
108+
1109
## 6.1.1 (2023-02-06)
2110

3111
#### Fixed

Diff for: CONTRIBUTING.md

+4
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@ there are a few guidelines we’d like you to follow:
1414
By submitting code as an individual you agree to the [individual contributor license agreement][individual-cla].
1515
By submitting code as an entity you agree to the [corporate contributor license agreement][corporate-cla].
1616

17+
## Security issues
18+
19+
If you believe you've found a security vulnerability, please read our [security policy](SECURITY.md) for more details.
20+
1721
## Reporting Issues
1822

1923
Before you submit your issue search the archive, maybe your question was already answered.

Diff for: SECURITY.md

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Reporting security issues
2+
3+
To report a security vulnerability, please send a report to [[email protected]](mailto:[email protected]).
4+
5+
This address can be used for all of Axelor's products. Do not report non-security-impacting bugs through this channel.
6+
7+
Provide a descriptive title and in the description of the report, include the following information :
8+
9+
- Detailed steps to reproduce the vulnerability (POC scripts, screenshots, and logs are all helpful).
10+
- Description of the effects of the vulnerability.
11+
- How the vulnerability affects the project usage.
12+
- The affected versions.
13+
14+
While submitting, please remove or obfuscate any private data.
15+
16+
After it has been submitted, the Security Team will investigate the vulnerability, determine its effects and
17+
criticality and notify to the reporter.

Diff for: axelor-common/build.gradle

-14
Original file line numberDiff line numberDiff line change
@@ -25,17 +25,3 @@ afterEvaluate {
2525
writeManifest(file("${projectDir}/bin/main"), false) // to eclipse output dir
2626
writeManifest(file("${projectDir}/out/production/resources"), false) // to intelij output dir
2727
}
28-
29-
jar {
30-
manifest {
31-
attributes(
32-
'Implementation-Title': project.name,
33-
'Implementation-Version': project.version,
34-
'Implementation-Vendor': 'Axelor',
35-
'Implementation-Vendor-Id': 'com.axelor',
36-
'Implementation-Vendor-Url': 'http://axelor.com',
37-
'Specification-Title': project.name,
38-
'Specification-Version': project.version,
39-
'Specification-Vendor': 'Axelor')
40-
}
41-
}

Diff for: axelor-core/build.gradle

+5
Original file line numberDiff line numberDiff line change
@@ -84,3 +84,8 @@ test {
8484
// Avoid Warnings for Reflective Access in `AppSettingsTest`
8585
jvmArgs = ["--add-opens", "java.base/java.util=ALL-UNNAMED", "--add-opens", "java.base/java.lang=ALL-UNNAMED"]
8686
}
87+
88+
license {
89+
include "**/*.xsd"
90+
excludePatterns.removeAll(['**/resources/**'] as Object[])
91+
}

Diff for: axelor-core/src/main/java/com/axelor/auth/AuthModule.java

-3
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,6 @@ protected final void configure() {
5252
return;
5353
}
5454

55-
// observe authentication-related events
56-
bind(AuthObserver.class);
57-
5855
// pac4j
5956
bind(AuthPac4jObserver.class);
6057
install(new AuthPac4jModule(context));

Diff for: axelor-core/src/main/java/com/axelor/auth/AuthObserver.java

-73
This file was deleted.

Diff for: axelor-core/src/main/java/com/axelor/auth/AuthSessionService.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
import org.apache.shiro.session.Session;
2424

2525
/** Manages session attributes. */
26-
class AuthSessionService {
26+
public class AuthSessionService {
2727
private static final String LOGIN_DATE = "com.axelor.internal.loginDate";
2828

2929
public void updateLoginDate() {

Diff for: axelor-core/src/main/java/com/axelor/auth/pac4j/AuthPac4jListener.java

+3
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
*/
1919
package com.axelor.auth.pac4j;
2020

21+
import com.axelor.auth.AuthSessionService;
2122
import com.axelor.auth.AuthUtils;
2223
import com.axelor.auth.UserAuthenticationInfo;
2324
import com.axelor.auth.db.User;
@@ -42,6 +43,7 @@ public class AuthPac4jListener implements AuthenticationListener {
4243
@Inject private Event<LogoutEvent> logoutEvent;
4344
@Inject private AuthPac4jProfileService profileService;
4445
@Inject private AxelorSessionManager sessionManager;
46+
@Inject private AuthSessionService sessionService;
4547

4648
private static final String UNKNOWN_USER = "User not found: %s";
4749

@@ -52,6 +54,7 @@ public void onSuccess(AuthenticationToken token, AuthenticationInfo info) {
5254

5355
if (user != null) {
5456
sessionManager.changeSessionId();
57+
sessionService.updateLoginDate();
5558
firePostLoginSuccess(token, user);
5659
return;
5760
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
/*
2+
* Axelor Business Solutions
3+
*
4+
* Copyright (C) 2005-2023 Axelor (<http://axelor.com>).
5+
*
6+
* This program is free software: you can redistribute it and/or modify
7+
* it under the terms of the GNU Affero General Public License as
8+
* published by the Free Software Foundation, either version 3 of the
9+
* License, or (at your option) any later version.
10+
*
11+
* This program is distributed in the hope that it will be useful,
12+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14+
* GNU Affero General Public License for more details.
15+
*
16+
* You should have received a copy of the GNU Affero General Public License
17+
* along with this program. If not, see <https://www.gnu.org/licenses/>.
18+
*/
19+
package com.axelor.auth.pac4j;
20+
21+
import com.axelor.auth.AuthSessionService;
22+
import com.axelor.auth.AuthUtils;
23+
import com.axelor.auth.db.User;
24+
import java.time.LocalDateTime;
25+
import java.util.List;
26+
import javax.inject.Inject;
27+
import javax.inject.Singleton;
28+
import org.apache.shiro.SecurityUtils;
29+
import org.pac4j.core.authorization.authorizer.Authorizer;
30+
import org.pac4j.core.context.WebContext;
31+
import org.pac4j.core.context.session.SessionStore;
32+
import org.pac4j.core.profile.UserProfile;
33+
34+
@Singleton
35+
public class AxelorUserAuthorizer implements Authorizer {
36+
37+
public static final String USER_AUTHORIZER_NAME = "AxelorUserAuthorizer";
38+
39+
private AuthSessionService authSessionService;
40+
41+
@Inject
42+
public AxelorUserAuthorizer(AuthSessionService authSessionService) {
43+
this.authSessionService = authSessionService;
44+
}
45+
46+
@Override
47+
public boolean isAuthorized(
48+
WebContext context, SessionStore sessionStore, List<UserProfile> profiles) {
49+
User user = AuthUtils.getUser();
50+
if (user == null) {
51+
return false;
52+
}
53+
if (!isAllowed(user)) {
54+
removeSession();
55+
return false;
56+
}
57+
58+
return true;
59+
}
60+
61+
private boolean isAllowed(User user) {
62+
final LocalDateTime loginDate =
63+
authSessionService.getLoginDate(AuthUtils.getSubject().getSession());
64+
return AuthUtils.isActive(user)
65+
&& (user.getPasswordUpdatedOn() == null
66+
|| loginDate != null && !loginDate.isBefore(user.getPasswordUpdatedOn()));
67+
}
68+
69+
private void removeSession() {
70+
try {
71+
SecurityUtils.getSubject().logout();
72+
} catch (Exception e) {
73+
// ignore
74+
}
75+
}
76+
}

Diff for: axelor-core/src/main/java/com/axelor/auth/pac4j/ConfigProvider.java

+5-1
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,12 @@ public class ConfigProvider implements Provider<Config> {
3131

3232
@Inject
3333
public ConfigProvider(
34-
Clients clients, AxelorCsrfAuthorizer csrfAuthorizer, AxelorCsrfMatcher csrfMatcher) {
34+
Clients clients,
35+
AxelorUserAuthorizer userAuthorizer,
36+
AxelorCsrfAuthorizer csrfAuthorizer,
37+
AxelorCsrfMatcher csrfMatcher) {
3538
config = new Config(clients);
39+
config.addAuthorizer(AxelorUserAuthorizer.USER_AUTHORIZER_NAME, userAuthorizer);
3640
config.addAuthorizer(AxelorCsrfAuthorizer.CSRF_AUTHORIZER_NAME, csrfAuthorizer);
3741
config.addMatcher(AxelorCsrfMatcher.CSRF_MATCHER_NAME, csrfMatcher);
3842
}

0 commit comments

Comments
 (0)