diff --git a/htdocs/adherents/class/api_members.class.php b/htdocs/adherents/class/api_members.class.php index a4a888ae9a5..99a4f401171 100644 --- a/htdocs/adherents/class/api_members.class.php +++ b/htdocs/adherents/class/api_members.class.php @@ -374,6 +374,10 @@ class Members extends DolibarrApi */ 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); diff --git a/htdocs/product/class/api_products.class.php b/htdocs/product/class/api_products.class.php index 809b8b160c3..25071801fe3 100644 --- a/htdocs/product/class/api_products.class.php +++ b/htdocs/product/class/api_products.class.php @@ -265,6 +265,10 @@ class Products extends DolibarrApi */ 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); diff --git a/htdocs/societe/class/api_contacts.class.php b/htdocs/societe/class/api_contacts.class.php index 29bb43d211d..0e3c10ce726 100644 --- a/htdocs/societe/class/api_contacts.class.php +++ b/htdocs/societe/class/api_contacts.class.php @@ -336,6 +336,10 @@ class Contacts extends DolibarrApi */ 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); diff --git a/htdocs/societe/class/api_thirdparties.class.php b/htdocs/societe/class/api_thirdparties.class.php index 0fe5d5e706e..ab38f62b2ed 100644 --- a/htdocs/societe/class/api_thirdparties.class.php +++ b/htdocs/societe/class/api_thirdparties.class.php @@ -269,6 +269,10 @@ class Thirdparties extends DolibarrApi */ 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);