Skip to content

Commit

Permalink
Fix: check security
Browse files Browse the repository at this point in the history
  • Loading branch information
hregis committed Oct 3, 2017
1 parent 4537e54 commit 45de1ca
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 0 deletions.
4 changes: 4 additions & 0 deletions htdocs/adherents/class/api_members.class.php
Expand Up @@ -374,6 +374,10 @@ function createSubscription($id, $start_date, $end_date, $amount, $label='')
*/
function getCategories($id, $sortfield = "s.rowid", $sortorder = 'ASC', $limit = 0, $page = 0)
{
if (! DolibarrApiAccess::$user->rights->categorie->lire) {
throw new RestException(401);
}

$categories = new Categorie($this->db);

$result = $categories->getListForItem($id, 'member', $sortfield, $sortorder, $limit, $page);
Expand Down
4 changes: 4 additions & 0 deletions htdocs/product/class/api_products.class.php
Expand Up @@ -265,6 +265,10 @@ function delete($id)
*/
function getCategories($id, $sortfield = "s.rowid", $sortorder = 'ASC', $limit = 0, $page = 0)
{
if (! DolibarrApiAccess::$user->rights->categorie->lire) {
throw new RestException(401);
}

$categories = new Categorie($this->db);

$result = $categories->getListForItem($id, 'product', $sortfield, $sortorder, $limit, $page);
Expand Down
4 changes: 4 additions & 0 deletions htdocs/societe/class/api_contacts.class.php
Expand Up @@ -336,6 +336,10 @@ function createUser($id, $request_data = NULL) {
*/
function getCategories($id, $sortfield = "s.rowid", $sortorder = 'ASC', $limit = 0, $page = 0)
{
if (! DolibarrApiAccess::$user->rights->categorie->lire) {
throw new RestException(401);
}

$categories = new Categorie($this->db);

$result = $categories->getListForItem($id, 'contact', $sortfield, $sortorder, $limit, $page);
Expand Down
4 changes: 4 additions & 0 deletions htdocs/societe/class/api_thirdparties.class.php
Expand Up @@ -269,6 +269,10 @@ function delete($id)
*/
function getCategories($id, $sortfield = "s.rowid", $sortorder = 'ASC', $limit = 0, $page = 0)
{
if (! DolibarrApiAccess::$user->rights->categorie->lire) {
throw new RestException(401);
}

$categories = new Categorie($this->db);

$result = $categories->getListForItem($id, 'customer', $sortfield, $sortorder, $limit, $page);
Expand Down

0 comments on commit 45de1ca

Please sign in to comment.