Commit Graph
237 Commits
Author SHA1 Message Date
Cédric Krier 6d1bc282b7 Remove extra '/' in request path in logging messages 2021-01-10 23:41:24 +01:00
Cédric Krier c6503c1a93 Add cached_property in tools
issue9277
review299951002
2020-06-17 00:33:30 +02:00
Cédric Krier d7ed5f91f5 Fix flake8 errors and warnings
We add the flake8 configuration used so we ensure everyone uses the same.
We remove the usage of __all__ for non public API.
When possible, we rationalize the class name according to its __name__ and module.

issue9082
review297061002
2020-03-01 12:33:54 +01:00
Cédric Krier 03b07a60e9 Use more appropriate HTTP status for Tryton exceptions
issue8929
review252781002
2020-01-20 22:25:12 +01:00
Nicolas Évrard 8fb13634ea Use direct access to backend classes
issue8836
review258421002
2019-12-06 17:33:47 +01:00
Cédric Krier 922c420fae Return bad request for Tryton exception instead of internal error
Those exceptions are expected behavior so it is the fault of the client, not
the server.

issue8768
review276221002
2019-11-17 17:36:07 +01:00
Cédric Krier 0fbf5cecd2 Add cache management on RPC
issue8233
review257231002
2019-04-08 10:10:40 +02:00
Cédric Krier ce0e68a287 Add HTML editor
issue8004
review54481002
2019-03-30 16:04:45 +01:00
Cédric Krier 51b857cc36 Simplify xmlrpc marshallers for Python3
issue8143
review45961002
2019-03-08 23:40:20 +01:00
Cédric Krier 0b6c923834 Add increasing delay on OperationalError
This increase the success rate of retry if the other transaction last.

issue8014
review50701002
2019-02-04 22:23:12 +01:00
Cédric Krier 88b1272d95 Return 429 TOO MANY REQUESTS on RateLimitException
This is a better HTTP Status than the default 500.

issue8001
review47751002
2019-02-04 22:19:37 +01:00
Cédric Krier da24071467 Make Cache transactional
We implement sync, commit and rollback to follow transaction semantic.
When a transaction clears a cache, the global cache is cleared only when the
transaction is committed meanwhile the transaction will use a cache for itself
only.
We remove _nocache option because the sync, commit and rollback operate only
for the transaction.

issue7975
review53521002
2019-01-18 11:57:11 +01:00
Cédric Krier cef6ffead0 Allow to redirect bus request
issue7943
review48691003
2019-01-18 11:01:22 +01:00
Cédric Krier 31dc11cf6d Run tasks at this end of cron execution and with_transaction
issue7781
review68391002
2018-12-30 00:22:41 +01:00
Cédric Krier e5bf50805d Return XML-RPC answer only to XML-RPC request
This prevents to answer an XML-RPC fault to a request which only set xml as
accepted mimetype.

issue7913
review66481002
2018-12-30 00:21:39 +01:00
Cédric Krier 5a7aca31ea Manage session with max_age and timeout
and clear session when password is changed.

The sessions are checked using on a fix maximum age of 30 days using the
create_date value. The write_date is updated as long as the delay of the last
update is not bigger than the session timeout.
RPC can request a fresh session. A fresh session is a session that was updated
last time before the session timeout. If it is not the case, the session is
deleted and a request to create a new session is sent to the client.
All the sessions of the users for which the password has been changed are also
deleted in order to ensure that stolen session can no more be used.
We use this new feature for set_preferences of user instead of duplicate the
login mechanism.

issue7568
review53331002
2018-08-26 18:04:05 +02:00
Cédric Krier ae06a8bca2 Add transactional queue and workers
issue7406
review45461002
2018-07-27 09:32:28 +02:00
Cédric Krier 8d291af9d9 Fallback to import http.client if HTTPStatus is not present
HTTPStatus is available only since Python 3.5
2018-07-16 15:47:15 +02:00
Cédric Krier 45a5984a0e Use HTTP status code
- FORBIDDEN for forbidden RPC and no database list
- UNAUTHORIZED for login failure

issue7565
review49511002
2018-07-16 14:47:05 +02:00
Cédric Krier 7f1b851962 Convert authorization key into string
The check method expect to receive a string for the key because it used for a
search against a Char field.

issue7546
review56291002
2018-07-02 23:22:09 +02:00
Cédric Krier d2a461390a Remove support for Python 2.7
issue7497
review53261002
2018-06-26 19:11:19 +02:00
Cédric Krier e85a4891ac Serve index.html for static directory
This allows to have shorter sao URL because it is without index.html.
Also this adds the support of static web root when launching WSGI app from a
different WSGI server.

issue6677
review45501002
2018-05-22 23:44:10 +02:00
Cédric Krier 0aed819d47 Add hostname configuration to list database
issue7375
review44991002
2018-05-22 23:42:35 +02:00
Cédric Krier 1a2f0edbbb Add _request context to with_transaction wrapper
issue7444
review45151002
2018-05-22 23:38:36 +02:00
Cédric Krier 1c32a02b64 Simplify API for Session
- Allow to extend session management with a domain
- Let security manage the logging
- Let check differentiate expired session and session that does not exist

issue7134
review39171002
2018-03-07 00:34:09 +01:00
Cédric Krier 7388e7b233 Add '_request' attribute to Transaction context
issue7110
review41031002
2018-02-14 19:22:03 +01:00
Cédric Krier 5a1bc137a3 Add a maximum size for request
issue6619
review38441002
2017-09-03 11:32:17 +02:00
brunnenschacht cb2d234230 Ensure the proper encoding for the authentication header response
issue6628
review36441002
2017-07-13 09:19:08 +02:00
Cédric Krier 1c92359998 Decode username only if it is bytes
The decoding is only needed on Python2 because bytes_to_wsgi returns always a
str but str on Python2 is not unicode.

issue6578
review41381002
2017-06-18 15:24:05 +02:00
Cédric Krier d1a971fb61 Decode username before logging it
The username of request authorisation is bytes encoded in UTF-8.
The logging module tries to decode it as ASCII by default.

issue6517
review34991002
2017-05-30 22:07:46 +02:00
Cédric Krier e7ff9ee619 Use compact separators to dump json
issue6373
review33991002
2017-03-23 22:51:36 +01:00
Cédric Krier 05972ae818 Add exception as description of internal error of user_application
issue6255
review29991002
2017-02-14 23:37:16 +01:00
Sergi Almacellas Abellana 5278085a98 Disable transaction cache for database list
issue6216
review31071002
2017-02-07 17:06:39 +01:00
Cédric Krier cdc5952145 Manage Cache in Transaction
issue6216
review33021002
2017-02-02 12:04:27 +01:00
Cédric Krier afdc884277 Return 429 status when too many login attempts
This prevents to consume too much resource by sleeping over a very long period.

issue6215
review29161002
2017-02-02 11:55:44 +01:00
Cédric Krier 94be12542c Return result after cache reset in with_transaction wrapper
issue6200
review34641002
2017-01-29 01:17:08 +01:00
Cédric Krier c0aa69fa23 Make wsgi app returns Internal Server Error on exception
If no protocol convert the data into a Response and if the data is an exception
it should be returned as an Internal Server Error instead of a succeed
response.
The exception can be used as description for the Internal Server Error.

issue6201
review31951002
2017-01-29 01:11:57 +01:00
Cédric Krier c2b76dd685 Use root user to init pool in with_pool wrapper
All requests do not have necessary a user id, for example request for user
application.

issue6199
review26041002
2017-01-29 01:07:33 +01:00
Cédric Krier f9c0457416 Remove support for simplejson
On Python 3, simplejson has a different behaviour than the stdlib json,
especially for dumping bytes.

issue6010
review33601002
2016-11-05 19:54:12 +01:00
Cédric Krier 965d010dc9 Add user application
issue5782
review28641002
2016-09-27 11:56:19 +02:00
Cédric Krier 3e90ed6675 Abort with 404 on wrong database name
The client must be able to distinct login failure because of wrong database and
failure because of wrong parameters.

issue5837
review32531002
2016-08-31 22:57:23 +02:00
Sergi Almacellas Abellana 5967d21d46 Remove database management from RPC
issue5384
review29311002
2016-07-07 16:05:45 +02:00
Cédric Krier 16f0e84f25 Format the exception inside the try/except
Outside the try/except sys.exc_info returns None values, so we must format the
traceback inside the try/except.

issue5647
review23221002
2016-06-18 12:04:45 +02:00
Cédric Krier 2c390fe71a Add customizable login process
It adds new configuration option to define the list of login methods.
It defines a new Exception to use to request user data during the login
process.
It separates the generic login attempt protection from the actual
authentication method.
It replace the API of the login methods to use a dictionary of parameters
instead of a single password.

issue5521
review16191003
2016-05-31 12:49:23 +02:00
Cédric Krier b08b37423d Decode data before json loads
issue5536
review23041002
2016-05-10 10:19:22 +02:00
Cédric Krier 5b68149ea8 Update translations 2016-05-01 10:59:39 +02:00
Thierry Bruyere 91cd4040fa Database locked at first wizard execution with sqlite backend
Cache.resets create a new transaction but SQLite keeps a lock from the previous
transaction is it was not committed.
This commit was removed by changeset 9b2e0aac2d9c

issue5388
review16211002
2016-04-30 23:26:47 +02:00
Cédric Krier 506552af4e Log as error DatabaseOperationalError exceptions 2016-04-06 23:57:58 +02:00
Cédric Krier 1b33a4b3ed Fix connection leak on postgresql
All connections must be put back to the pool otherwise they will never be
reused and so exhaust the pool limit.

issue5421
review20121002
2016-03-25 10:46:12 +01:00
Cédric Krier c19f93cd9b NotLogged exception is no more used
issue5415
review17971003
2016-03-21 23:39:30 +01:00