2
0
forked from Wavyzz/dolibarr

Debug v18

This commit is contained in:
Laurent Destailleur
2023-04-03 12:06:16 +02:00
parent 254e785c47
commit 2f34f179b9
4 changed files with 17 additions and 10 deletions

View File

@@ -54,6 +54,9 @@ $format = 'int';
// Load object according to $id and $element
$object = fetchObjectByElement($id, $element);
if (!is_object($object)) {
httponly_accessforbidden("Bad value for combination of parameters element/field: Object not found."); // This includes the exit.
}
$object->fields[$field] = array('type' => $format, 'enabled' => 1);
@@ -81,7 +84,7 @@ if (preg_match('/status$/', $field)) {
} elseif ($element == 'product' && in_array($field, array('tosell', 'tobuy', 'tobatch'))) { // Special case for products
restrictedArea($user, 'produit|service', $object, 'product&product', '', '', 'rowid');
} else {
httponly_accessforbidden("Bad value for combination of parameters element/field."); // This includes the exit.
httponly_accessforbidden("Bad value for combination of parameters element/field: Field not supported."); // This includes the exit.
}

View File

@@ -11357,6 +11357,12 @@ function getElementProperties($element_type)
$classname = 'Productlot';
$element = 'productlot';
$subelement = '';
} elseif ($element_type == 'websitepage') {
$classpath = 'website/class';
$classfile = 'websitepage';
$classname = 'Websitepage';
$module = 'website';
$subelement = 'websitepage';
}
if (empty($classfile)) {
@@ -11391,7 +11397,7 @@ function getElementProperties($element_type)
*/
function fetchObjectByElement($element_id, $element_type, $element_ref = '')
{
global $conf, $db;
global $db;
$ret = 0;

View File

@@ -332,7 +332,7 @@ function dolGetLdapPasswordHash($password, $type = 'md5')
* This method check permission on module then call checkUserAccessToObject() for permission on object (according to entity and socid of user).
*
* @param User $user User to check
* @param string $features Features to check (it must be module $object->element. Can be a 'or' check with 'levela|levelb'.
* @param string $features Features to check (it must be module name or $object->element. Can be a 'or' check with 'levela|levelb'.
* Examples: 'societe', 'contact', 'produit&service', 'produit|service', ...)
* This is used to check permission $user->rights->features->...
* @param int|string|object $object Object or Object ID or list of Object ID if we want to check a particular record (optional) is linked to a owned thirdparty (optional).
@@ -364,7 +364,7 @@ function restrictedArea(User $user, $features, $object = 0, $tableandshare = '',
//dol_syslog("functions.lib:restrictedArea $feature, $objectid, $dbtablename, $feature2, $dbt_socfield, $dbt_select, $isdraft");
//print "user_id=".$user->id.", features=".$features.", feature2=".$feature2.", objectid=".$objectid;
//print ", dbtablename=".$tableandshare.", dbt_socfield=".$dbt_keyfield.", dbt_select=".$dbt_select;
//print ", perm: ".$features."->".$feature2."=".($user->rights->$features->$feature2->lire)."<br>";
//print ", perm: ".$features."->".$feature2."=".($user->hasRight($features, $feature2, 'lire'))."<br>";
$parentfortableentity = '';
@@ -388,9 +388,7 @@ function restrictedArea(User $user, $features, $object = 0, $tableandshare = '',
$features = 'adherent';
$feature2 = 'cotisation';
}
if ($features == 'websitepage') {
$features = 'website';
$tableandshare = 'website_page';
if ($features == 'website' && is_object($object) && $object->element == 'websitepage') {
$parentfortableentity = 'fk_website@website';
}
if ($features == 'project') {

View File

@@ -260,17 +260,17 @@ class modWebhook extends DolibarrModules
// Add here entries to declare new permissions
/* BEGIN MODULEBUILDER PERMISSIONS */
$this->rights[$r][0] = $this->numero . sprintf("%02d", $r + 1); // Permission id (must not be already used)
$this->rights[$r][1] = 'Read objects of Webhook'; // Permission label
$this->rights[$r][1] = 'Read Webhooks'; // Permission label
$this->rights[$r][4] = 'webhook_target';
$this->rights[$r][5] = 'read'; // In php code, permission will be checked by test if ($user->rights->webhook->webhook_target->read)
$r++;
$this->rights[$r][0] = $this->numero . sprintf("%02d", $r + 1); // Permission id (must not be already used)
$this->rights[$r][1] = 'Create/Update objects of Webhook'; // Permission label
$this->rights[$r][1] = 'Create/Update Webhooks'; // Permission label
$this->rights[$r][4] = 'webhook_target';
$this->rights[$r][5] = 'write'; // In php code, permission will be checked by test if ($user->rights->webhook->webhook_target->write)
$r++;
$this->rights[$r][0] = $this->numero . sprintf("%02d", $r + 1); // Permission id (must not be already used)
$this->rights[$r][1] = 'Delete objects of Webhook'; // Permission label
$this->rights[$r][1] = 'Delete Webhooks'; // Permission label
$this->rights[$r][4] = 'webhook_target';
$this->rights[$r][5] = 'delete'; // In php code, permission will be checked by test if ($user->rights->webhook->webhook_target->delete)
$r++;