Commit Graph
10472 Commits
Author SHA1 Message Date
Nicolas Malin 930f4af7a2 Improved: Convert CommonServices.xml from mini lang to groovy
(OFBIZ-11402)

Thanks to Wiebke Pätzold for providing the patch
2020-03-10 14:09:08 +01:00
Michael Brohl 03b3a7bc02 Improved: Upgrade Freemarker from 2.3.29 to 2.3.30.
(OFBIZ-11445)
2020-03-08 01:13:05 +01:00
Nicolas Malin 9a50fa907b Fixed: Refactoring permission model call, alone permission service failed
(OFBIZ-11440)

During refactoring (OFBIZ-7113), the service reader used two different methods to read a
permission service definition if is present alone or in a group. For the alone version a link
was missing between the service and the permission service to resolve correctly the permission.

To solve this problem I reorganized to use only one method to initialize a service model permission.

Other point, an attribute renaming was missed : action -> permissionMainAction, when service permission call was called

Last, these problems weren't detected before due to missing unit test on failure service permission, now cover.
2020-03-04 21:18:30 +01:00
Daniel Watford 0ece441228 Fixed: Fixed line lengths in ModelFormFieldTest to adhere to coding standards
(OFBIZ-11418)
2020-02-28 08:02:12 +00:00
Daniel Watford 5640de4eba Documented: Documented use of field attribute parameter-name and
lookup field attribute target-parameter in widget-form.xsd

(OFBIZ-11418)
2020-02-27 20:50:41 +00:00
Daniel Watford 08a371d047 Improved: Use FlexibleStringExpander in form widget lookup field field
target parameters

(OFBIZ-11418)

Changed target-parameter attribute of the form widget's Lookup field to
use the FlexibleStringExpander type rather than String. This has been
done to allow reference to other form fields which may have had their
parameter-name attribute set to a FlexibleStringExpander expression.
2020-02-27 18:42:11 +01:00
Jacques Le Roux c34491892a Improved:
Implemented:
Documented:
Completed:
Reverted:
Fixed:
Improved: no functional change
(OFBIZ-)
Explanation
Thanks:
2020-02-27 14:36:26 +01:00
Suraj Khurana cc52b98151 Improved: Defects reported by code analysis tool.
(OFBIZ-10571)

Following refactoring done -
-- Refactored code to fall in line with some java standards.
-- Based on FindBugs suggestion, refactored some classes to have static nested classes instead of inner class.

Thanks Girish Vasmatkar for reporting the issue and providing the patch.
2020-02-26 16:06:55 +05:30
Jacques Le Roux 4697bf5faa Fixed: DatabaseUtil.getColumnInfo(...) does not retrieve primary keys due to
connection-locks
(OFBIZ-11312)

The method DatabaseUtil.getColumnInfo(...) uses an elaborate algorithm using a
List<Future<AbstractCountingCallable>> object. This does not work properly as it
runs into connection-locks. When debugging the error does not occur. I assume
that the slower pace of debugging prevents the error.

Thanks: Benjamin Jugl
2020-02-26 08:38:26 +01:00
Michael Brohl b55279101b Merge pull request #29 from PierreSmits/OFBIZ-10955-FieldType
Improved: field type Integer is missing in definitions.

(OFBIZ-10955)

Thanks Pierre Smits for the contribution.
2020-02-25 21:55:18 +01:00
Michael Brohl 8afb711ef3 Fixed: Fluent API Bug in getFieldList().
(OFBIZ-10298)

Thanks Benjamin Jugl for reporting and providing the patch.
2020-02-25 21:15:37 +01:00
Michael Brohl 74db8bde12 Improved: Performance optimization for entities in xml data export.
(OFBIZ-10157)

Thanks Kyra Pritzel-Hentley for reporting and providing the patch.
2020-02-25 20:31:53 +01:00
Pierre Smits 75ed0c48ee Fixed: Field Type definitions
(OFBIZ-10955)

Adding missing field type definition for Apache Derby, MySQL, PostgreSQL
2020-02-25 12:59:58 +01:00
Michael Brohl 59f05e6df1 Improved: Move permission checks to service definitions via permission
service.

(OFBIZ-11357)

Thanks Pawan Verma for the suggestion and Wiebke Pätzold for providing
the patch.
2020-02-25 12:05:34 +01:00
Jacques Le Roux 0e7d31912b Fixed: Improve ObjectInputStream class (CVE-2019-0189)
Improved: no functional change
(OFBIZ-10837) (OFBIZ-11398)

Steps to generate:
1. Navigate to - catalog/control/EditProdCatalog?prodCatalogId=TestCatalog
2. Click on - CREATE SEO CATEGORY/PRODUCTS
3. The broken page will be displayed

The issue is due to the use of a GString in
createMissingCategoryAndProductAltUrls().

This:
    result.successMessageList = [
        "Categories updated: ${categoriesUpdated}",
        "Products updated: ${productsUpdated}"

As it's common to use such expressions I have added the necessary
org.codehaus.groovy.runtime.GStringImpl groovy.lang.GString
to the white list of classes in listOfSafeObjectsForInputStream in
SafeObjectInputStream.properties

I finally have also decided to use this property as default and commented for
committers to be aware that it should be also put in DEFAULT_WHITELIST_PATTERN
in SafeObjectInputStream class. Because if, for a reason,
listOfSafeObjectsForInputStream is empty OFBiz will still be protected

Thanks: Dikpal Kanungo for reporting
2020-02-24 11:00:51 +01:00
Daniel Watford e76cbd1f34 Improved: Added ModelFormField testing to ensure getting a field's
current container id will return an evaulated FlexibleStringExpander
expression.

(OFBIZ-4035)
2020-02-23 20:32:50 +01:00
Daniel Watford d6132fa534 Documented: change the id Attribute for input fields in the model macro
form renderer from String to FlexibleStringExpander

(OFBIZ-4035)

Document that the id-name attribute for a form widget's field
element can use ${} notation. Also document the default value if id-name is
not set.
2020-02-23 20:28:45 +01:00
Michael Brohl f5a8479c46 Documented: Upgrades the documentation references in
catalina/ofbiz-component.xml to the 9.0 documentation.
2020-02-23 12:45:21 +01:00
Michael Brohl 0d623c077f Upgrade Tomcat from 9.0.29 to 9.0.31
(OFBIZ-11407)

Overriding the new default property secretRequired to be not required
and added the default property "secret" in the commented out section.
2020-02-23 12:23:43 +01:00
Nicolas Malin dff226ea60 Improved: Refactoring old job process
(OFBIZ-11200)

Before this commit, to purge old job we use the thread job manager to check
if some job need to be run and if the pool is empty, check the old job to purge.

I detected a problem when you have many job's server and more than one pool.
When you have a first pool that run regular job and a second that receive
huge asynchrone services (by persist call), the server who manage the second pool
have rarely the possibility to purge their jobs that, by the way, increase JobSandbox table.

The Server who manage the first pool, call often the purge process, but the table size
generate a long query time to purge few element. Long query time, run often,
this purge process load uselessly the database.

After analyze, I refactoring these following items :

 * When you call JobSandbox table for a purge, use a limit on the query
   with the max thread pool because when you have the database return,
   you purge only with this limit so this help the database to not scan
   the whole table. Other small improvement, do not sort the result
   (no functional gain).

 * Purge by the pool thread is nice, each server can only purge their
   own job (filtered on run_by_instance_id), to help an overloaded server,
   I was rehability purgeOldJobs service that it can run with specific
    parameter to make assistance.

 * Last, all job services are historical on class org.apache.ofbiz.service.ServiceUtil,
   I moved them all in a new dedicate class org.apache.ofbiz.service.job.JobServices
2020-02-22 18:48:32 +01:00
Michael Brohl 211c1924a5 Provide a FileItem entry in UtilHttp.getMultiPartParameterMap.
(OFBIZ-11346)
2020-02-22 11:57:11 +01:00
Michael Brohl 30566a6bde Convert Thesaurus services in CommonServices.xml from mini lang to
groovy.
(OFBIZ-11357)

Thanks Wiebke Pätzold for reporting and providing the patch.
2020-02-22 10:29:35 +01:00
Jacques Le Roux be3da7119c Fixed: replaceFirst sensible to variable pattern
(OFBIZ-11396)

When using variable pattern with replaceFirst you may cross issues if the
pattern contains specific tokens. For instance on Windows with the path
"C:\projectsASF\Git\ofbiz-framework/" you have inside the token "\p" which has
a special meaning.
2020-02-22 09:41:11 +01:00
Deepak Dixit 0e007d80c2 Added missing GeoAssoc data for Ladakh geo
(OFBIZ-11399)
2020-02-22 13:03:01 +05:30
Deepak Dixit 4f25633992 Update India Geo information according to ISO notifications 2019-11-22
(OFBIZ-11399)

Change of subdivision category from state to Union territory for IN-JK; Addition of Union territory IN-LA;
2020-02-22 12:52:45 +05:30
Suraj Khurana 31ff921db3 Merge branch 'trunk' of https://gitbox.apache.org/repos/asf/ofbiz-framework into trunk 2020-02-22 12:42:15 +05:30
Suraj Khurana 24fb560ecf Fixed: UserLoginPasswordHistory is not maintaining password as present in UserLogin.
(OFBIZ-10802)
Thanks Rohit Koushal for the patch. Thanks Jacques Le Roux and Gil Portenseigne for the review.
2020-02-22 12:41:36 +05:30
Jacques Le Roux 549543ace5 Fixed: replaceFirst sensible to variable pattern
(OFBIZ-11396)

When using variable pattern with replaceFirst you may cross issues if the
pattern contains specific tokens. For instance on Windows with the path
"C:\projectsASF\Git\ofbiz-framework/" you have inside the token "\p" which has
a special meaning.
2020-02-22 07:32:15 +01:00
Pawan Verma f25c7d33dc Improved: Enhance the Programmable Export feature for EntityQuery support
(OFBIZ-11158)

EntityQuery usage to perform data fetching is increasing, we should also add support for EntityQuery in ProgramExport feature.

Thanks: Devanshu Vyas for report and patch and Suraj Khurana, Nicolas Malin for the review.
2020-02-22 11:22:34 +05:30
Nicolas Malin 0da10ea897 Fixed: FindGeneric failed to generate forms
(OFBIZ-11335)

The commit 1941a05a34 introduce the visualTheme
to generate a form with FactoryForm and forms present on FindGeneric has been forget

Thanks to Sebastian Berg for raise this issue
2020-02-20 19:34:01 +01:00
Nicolas Malin 296417a7bd Fixed: Correct check style issue on ModelTheme 2020-02-20 14:50:19 +01:00
Nicolas Malin 38f972a0d0 Improved: Add CommonForms as template pattern configured by theme
(OFBIZ-11335)

Currently on OFBiz we implemented a process to define some different
screen and menu that can be implemented by the theming.
But for the form we have nothing. All style are hard coded on each

    <grid name="ListEntities" ...
      odd-row-style="alternate-row" default-table-style="basic-table hover-bar">

I extend the theming implementation principle to forms element with adding :
 * a new xsd element common-forms (like common-screens)
 * some default form templates to extend :
   * grid CommonSimpleGrid
   * grid CommonBasicGrid
   * form CommonSimpleList
   * form CommonBasicList
   * form CommonInLineEditList
   * form CommonBasicSingle

We can use its like :

    <form name="LayoutDemoList" extends="CommonBasicList"
          extends-resource="component://common/widget/CommonForms.xml"

The main difficulty raise to this task was propage the visualTheme during
the ModelForm intanciation, because we need to load wiget style
(and some other information wanted on the template) on model load in memory.
This is cover by commit 1941a05a34.

Forms present on the screen https://localhost:8443/webtools/control/WebtoolsLayoutDemo
are now extend through with theme.

Finally with this we can extend style form (pagination, header, line and so on ...)
directly by your theme without change the framework.
2020-02-20 14:49:11 +01:00
Nicolas Malin 1941a05a34 Improved: Manage VisualTheme in ModelForm
(OFBIZ-11335)

Related to issue OFBIZ-11335, extends form's factories and form's models
to support a visualTheme during the model creation.

This extend help centralize style information used by forms on a theme.
For performance reason when the model is loaded in memory, all theme information
need to be present to set immutable as possible to put it in cache
(implies why the key cache contains now the visualThemeId).
2020-02-20 14:34:28 +01:00
Jacques Le Roux 969f48b7c9 Fixed: Add 'controlPath' attribute to 'ofbizUrl' freemarker macro
(OFBIZ-11317)

In some place, like at least themes/tomahawk/template/AppBarClose.ftl the CSRF
token is not generated. Because in those places OfbizUrlTransform is used.

An immediate solution is to add the CSRF token generation in OfbizUrlTransform
class.

A definitive solution is to complete OFBIZ-11229
"Merge UrlRegexpTransform and OfbizUrlTransform classes"
2020-02-15 13:24:09 +01:00
Gil Portenseigne 8653b6374e Improved: Error in user impersonation with sub permission
(OFBIZ-11342)

Improved javadoc
Set 'checkMultiLevelAdminPermissionValidity' visibility to default
Add another test verifying that hierarchy in permission is respected

Thanks Mathieu for your review
2020-02-13 15:36:59 +01:00
Gil Portenseigne c73b97eb29 Fixed: Error in user impersonation with sub permission
(OFBIZ-11342)

Add unit tests for permission control feature.
Add new method to manage multilevel permission control.
This allowing an user with PARTYMGR_ADMIN permission to impersonate
another user with PARTYMGR_PCM_CREATE permission.
2020-02-12 09:53:45 +01:00
Michael Brohl 3788f6766a Revert "Multi Part Input Parameters not Available in Groovy Event (OFBIZ-5048)"
This reverts commit 8af3e9ce6b.
2020-02-11 21:49:15 +01:00
Michael Brohl fc21237fee Fixed: Form widget field with input-method="time-dropdown" unable to
understand the default time.
(OFBIZ-11150)

Thanks Wiebke Pätzold for reporting and providing the patch.
2020-02-07 16:36:10 +01:00
Nicolas Malin 47e689b360 Fixed: Crashed Scheduled jobs are not getting rescheduled with temporal expression
(OFBIZ-11340)

When a OFBiz server are stopped or crashed with job on queued state,
at the start, they are restarted but without information on tempExprId and recurrenceInfoId

This causes a break for recurrence jobs to their planning

Thanks to Mohammed Rehan Khan for this issue and Scott Gray for the review.
2020-02-06 17:02:12 +01:00
Nicolas Malin 30a389c8d9 Fixed: correct check style issue on ComponentContainerTest.java
No functionnal change
2020-02-06 13:29:26 +01:00
Jacques Le Roux 350c71f4df Fixed: setUserTimeZone should ran only once based on error
(OFBIZ-11329)

This will be notably useful when committing CSRF solution as explained in
OFBIZ-11306:

SetTimeZoneFromBrowser when starting gives a  RequestHandlerException:
Invalid or missing CSRF token for AJAX call to path '/SetTimeZoneFromBrowser'.
Also not only when starting.

Thanks: James Yong for review
2020-02-05 09:30:55 +01:00
Jacques Le Roux d5f19e3560 Fixed: impersonateLogin
(OFBIZ-5409)

I reopended this old issue because, while working on  OFBIZ-11329, I found that
userLogin and impersonateLogin should be removed from
jsonResponseFromRequestAttributes

Thanks: James Yong for pointing that out
2020-02-04 15:35:40 +01:00
Jacques Le Roux fec0e19de0 Improved: no functional change
Fixed Javadoc creation issue reported at INFRA-19807

Thanks: Chris Lambertus
2020-02-04 09:45:55 +01:00
Michael Brohl 8af3e9ce6b Multi Part Input Parameters not Available in Groovy Event
(OFBIZ-5048)

This change provides easier access to the FileItem by not wrapping it
into a buffer.
2020-01-31 15:50:47 +01:00
Michael Brohl 765fdbbbd8 Extend UtilHttp.urlEncodeArgs API with preserveEmpty-parameter
(OFBIZ-10198)

This patch extends the current UtilHttp.urlEncodeArgs() method with an
additional input parameter: boolean preserveEmpty.

It allows to get a query string with empty parameters, useful if the
receiver expects mandatory parameters or wants to explicit
override/clear existing values with an empty one.

Thanks Martin Becker for reporting and providing the patch.
2020-01-30 21:33:41 +01:00
Michael Brohl 0a6d5c54e4 Improved: Add Asciidoc template for plugin creation task
(OFBIZ-10322)

Create a README.adoc stub and help file stub in the new format under
framework/resources/templates and use in the plugin creation task.

Thanks Ulrich Heidfeld for providing the patch.
2020-01-30 20:34:40 +01:00
Daniel Watford 52e21a3d2e Improved: Use FlexibleStringExpander for field parameter names.
(OFBIZ-11330)

Allows generation of unique names when repeating rendering of a form on a screen.
Added test cases to ensure parameter names can be built using FlexibleStringExpander.
2020-01-29 14:05:37 +01:00
Nicolas Malin 91fa4a958c Fixed: Clean unecessary code and convert to groovy syntax
No functional change

The code present on ViewGeneric.groovy has been migrated from bsh script
without deep rewrite.

I removed all unecessary or redund code to lighten the reading
2020-01-29 10:50:30 +01:00
Nicolas Malin 1ee1ec76d6 Fixed: Change 'restMethod' by '_method' in request parameters
(OFBIZ-11007)

Some issue has been introduce on the previous commit 6e1c7b5 [1], corrected by this one :
  * the view link on ListGeneric failed
  * the paginate on ListGeneric failed

I also simplify the url writing with delegate the entity path generation and translation
to two function on EntityUtil : entityToPath and getPkValuesMapFromPath

thanks to Pawan Verma to spot the pagination problem

[1] https://gitbox.apache.org/repos/asf?p=ofbiz-framework.git;h=6e1c7b5
2020-01-29 10:50:30 +01:00
Nicolas Malin 11cf350302 Improved: Change 'restMethod' by '_method' in request parameters
(OFBIZ-11332)

When we analyse a request method, we currently check the parameter "restMethod".
Mathieu Lirzin propose [1] to use "_method" instead to use a parameter name more generic

I create a new function UtilHttp.getRequestMethod() to centralize the request method resolution.

[1] https://issues.apache.org/jira/browse/OFBIZ-11007?focusedCommentId=17012712&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-17012712
2020-01-29 10:50:29 +01:00