-
-
Notifications
You must be signed in to change notification settings - Fork 3.2k
QUAL: API contract: RestException update, check if thirdparty exists before creating/updating contract #36007
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
PUT error before changes |
086a7d6 to
d67eeb4
Compare
|
The improvements that this PR addresses was detected during bug #35655 |
d67eeb4 to
0909f6c
Compare
3c17736 to
ea23265
Compare
|
Hurl tests good - one of these days autocorrect is gonna write hurl tastes good ;-) |
|
Maybe #36024 has to be merged before, because they might conflict? |
|
for acivateLine function the right is : DolibarrApiAccess::$user->hasRight('contrat', 'activer') |
…before creating contract
e1ccc1d to
ef3e495
Compare
|
this is not good !! getEntity() can return "1,2,3,x" !
|
|
@JonBendtsen getEntity('contrat') return contract sharings with the current entity, not the authorized sharing of a user |
We could make the test on $conf->entity because conf->entity is already value we are logged on with DOLAPIENTITY We can also add a check in phpunit in CodingPhpTest to return a CI error if we find "= getEntity" to avoid error in future. |
Pb is just that you do a != on string with several int instead of an int. |
|
I had some editor update issues such that it did not show the right file contents even though I had switched the branch - probably because I changed the branch out under it. I will submit a new PR |
|
@JonBendtsen @eldy The creation and updating of contracts (or other objects) should be limited to "$conf->entity" because contracts can be shared, but if we are in the current entity with value 1 and the "$entity" field at the time of creation is set to 2... we should also check if the user has the right to create contracts on entity 2! |
…before creating/updating contract (Dolibarr#36007) * QUAL: API contract: RestException update, check if thirdparty exists before creating contract * also checking if socid exists during put * using the entity of this contract * also fixing entity during post * some hurl tests of contract api * check if contract id is 0, because that is not possible * check (un)activate permissions and getEntity() --------- Co-authored-by: Jon Bendtsen <[email protected]> Co-authored-by: Laurent Destailleur <[email protected]>


QUAL API contract: RestException update, check if thirdparty exists before use in POST/PUT
This PR adds some RestExceptions to the contract api. It also checks if thirdparty exists before creating/updating a contract. As well as introduce some hurl testing of api contract