Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
dolibarr
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container registry
Model registry
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Software_Artifact_Infrastructure_Repository
dolibarr
Commits
160eb194
Commit
160eb194
authored
8 years ago
by
Laurent Destailleur
Browse files
Options
Downloads
Patches
Plain Diff
Clean REST response for user and third parties
parent
f011197e
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
htdocs/societe/class/api_thirdparties.class.php
+20
-1
20 additions, 1 deletion
htdocs/societe/class/api_thirdparties.class.php
htdocs/user/class/api_users.class.php
+16
-4
16 additions, 4 deletions
htdocs/user/class/api_users.class.php
with
36 additions
and
5 deletions
htdocs/societe/class/api_thirdparties.class.php
+
20
−
1
View file @
160eb194
...
@@ -311,6 +311,25 @@ class Thirdparties extends DolibarrApi
...
@@ -311,6 +311,25 @@ class Thirdparties extends DolibarrApi
return
$this
->
company
;
return
$this
->
company
;
}
}
/**
* Clean sensible object datas
*
* @param object $object Object to clean
* @return array Array of cleaned object properties
*/
function
_cleanObjectDatas
(
$object
)
{
$object
=
parent
::
_cleanObjectDatas
(
$object
);
unset
(
$object
->
total_ht
);
unset
(
$object
->
total_tva
);
unset
(
$object
->
total_localtax1
);
unset
(
$object
->
total_localtax2
);
unset
(
$object
->
total_ttc
);
return
$object
;
}
/**
/**
* Validate fields before create or update object
* Validate fields before create or update object
*
*
...
...
This diff is collapsed.
Click to expand it.
htdocs/user/class/api_users.class.php
+
16
−
4
View file @
160eb194
...
@@ -227,7 +227,7 @@ class Users extends DolibarrApi
...
@@ -227,7 +227,7 @@ class Users extends DolibarrApi
*
*
* @param int $id User ID
* @param int $id User ID
* @param int $group Group ID
* @param int $group Group ID
* @return int
* @return int
1 if success
*
*
* @url GET {id}/setGroup/{group}
* @url GET {id}/setGroup/{group}
*/
*/
...
@@ -246,7 +246,13 @@ class Users extends DolibarrApi
...
@@ -246,7 +246,13 @@ class Users extends DolibarrApi
throw
new
RestException
(
401
,
'Access not allowed for login '
.
DolibarrApiAccess
::
$user
->
login
);
throw
new
RestException
(
401
,
'Access not allowed for login '
.
DolibarrApiAccess
::
$user
->
login
);
}
}
return
$this
->
useraccount
->
SetInGroup
(
$group
,
1
);
$result
=
$this
->
useraccount
->
SetInGroup
(
$group
,
1
);
if
(
!
(
$result
>
0
))
{
throw
new
RestException
(
500
,
$this
->
useraccount
->
error
);
}
return
1
;
}
}
/**
/**
...
@@ -287,6 +293,12 @@ class Users extends DolibarrApi
...
@@ -287,6 +293,12 @@ class Users extends DolibarrApi
unset
(
$object
->
lastsearch_values
);
unset
(
$object
->
lastsearch_values
);
unset
(
$object
->
lastsearch_values_tmp
);
unset
(
$object
->
lastsearch_values_tmp
);
unset
(
$object
->
total_ht
);
unset
(
$object
->
total_tva
);
unset
(
$object
->
total_localtax1
);
unset
(
$object
->
total_localtax2
);
unset
(
$object
->
total_ttc
);
return
$object
;
return
$object
;
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment