diff --git a/htdocs/adherents/card.php b/htdocs/adherents/card.php index c47321dbf7c..66a75b0b804 100644 --- a/htdocs/adherents/card.php +++ b/htdocs/adherents/card.php @@ -98,14 +98,14 @@ if ($id > 0 || !empty($ref)) { $result = $object->fetch($id, $ref); // Define variables to know what current user can do on users - $canadduser = ($user->admin || $user->rights->user->user->creer); + $canadduser = ($user->admin || $user->hasRight('user', 'user', 'creer')); // Define variables to know what current user can do on properties of user linked to edited member if ($object->user_id) { // $User is the user who edits, $object->user_id is the id of the related user in the edited member - $caneditfielduser = ((($user->id == $object->user_id) && $user->rights->user->self->creer) - || (($user->id != $object->user_id) && $user->rights->user->user->creer)); - $caneditpassworduser = ((($user->id == $object->user_id) && $user->rights->user->self->password) - || (($user->id != $object->user_id) && $user->rights->user->user->password)); + $caneditfielduser = ((($user->id == $object->user_id) && $user->hasRight('user', 'self', 'creer')) + || (($user->id != $object->user_id) && $user->hasRight('user', 'user', 'creer'))); + $caneditpassworduser = ((($user->id == $object->user_id) && $user->hasRight('user', 'self', 'password')) + || (($user->id != $object->user_id) && $user->hasRight('user', 'user', 'password'))); } } @@ -154,9 +154,9 @@ if (empty($reshook)) { $action = ''; } - if ($action == 'setuserid' && ($user->rights->user->self->creer || $user->rights->user->user->creer)) { + if ($action == 'setuserid' && ($user->hasRight('user', 'self', 'creer') || $user->hasRight('user', 'user', 'creer'))) { $error = 0; - if (empty($user->rights->user->user->creer)) { // If can edit only itself user, we can link to itself only + if (empty($user->hasRight('user', 'user', 'creer'))) { // If can edit only itself user, we can link to itself only if ($userid != $user->id && $userid != $object->user_id) { $error++; setEventMessages($langs->trans("ErrorUserPermissionAllowsToLinksToItselfOnly"), null, 'errors'); @@ -206,7 +206,7 @@ if (empty($reshook)) { } // Create user from a member - if ($action == 'confirm_create_user' && $confirm == 'yes' && $user->rights->user->user->creer) { + if ($action == 'confirm_create_user' && $confirm == 'yes' && $user->hasRight('user', 'user', 'creer')) { if ($result > 0) { // Creation user $nuser = new User($db); @@ -230,7 +230,7 @@ if (empty($reshook)) { } // Create third party from a member - if ($action == 'confirm_create_thirdparty' && $confirm == 'yes' && $user->rights->societe->creer) { + if ($action == 'confirm_create_thirdparty' && $confirm == 'yes' && $user->hasRight('societe', 'creer')) { if ($result > 0) { // User creation $company = new Societe($db); @@ -617,7 +617,7 @@ if (empty($reshook)) { } } - if ($user->rights->adherent->supprimer && $action == 'confirm_delete' && $confirm == 'yes') { + if ($user->hasRight('adherent', 'supprimer') && $action == 'confirm_delete' && $confirm == 'yes') { $result = $object->delete($id, $user); if ($result > 0) { if (!empty($backtopage)) { @@ -706,7 +706,7 @@ if (empty($reshook)) { $action = ''; } - if ($user->rights->adherent->supprimer && $action == 'confirm_resiliate') { + if ($user->hasRight('adherent', 'supprimer') && $action == 'confirm_resiliate') { $error = 0; if ($confirm == 'yes') { @@ -777,7 +777,7 @@ if (empty($reshook)) { } } - if ($user->rights->adherent->supprimer && $action == 'confirm_exclude') { + if ($user->hasRight('adherent', 'supprimer') && $action == 'confirm_exclude') { $error = 0; if ($confirm == 'yes') { @@ -849,7 +849,7 @@ if (empty($reshook)) { } // SPIP Management - if ($user->rights->adherent->supprimer && $action == 'confirm_del_spip' && $confirm == 'yes') { + if ($user->hasRight('adherent', 'supprimer') && $action == 'confirm_del_spip' && $confirm == 'yes') { if (!count($object->errors)) { if (!$mailmanspip->del_to_spip($object)) { setEventMessages($langs->trans('DeleteIntoSpipError').': '.$mailmanspip->error, null, 'errors'); @@ -1118,7 +1118,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { print "\n"; // Categories - if (isModEnabled('categorie') && !empty($user->rights->categorie->lire)) { + if (isModEnabled('categorie') && $user->hasRight('categorie', 'lire')) { print '
| '.$langs->trans("Categories").' | '; print ''; print $form->showCategories($object->id, Categorie::TYPE_MEMBER, 1); @@ -1862,7 +1862,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { // Login Dolibarr - Link to user print ' | |
| '; - $editenable = $user->hasRight('adherent', 'creer') && $user->rights->user->user->creer; + $editenable = $user->hasRight('adherent', 'creer') && $user->hasRight('user', 'user', 'creer'); print $form->editfieldkey('LinkedToDolibarrUser', 'login', '', $object, $editenable); print ' | ';
if ($action == 'editlogin') {
@@ -1944,7 +1944,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
// Resiliate
if (Adherent::STATUS_VALIDATED == $object->statut) {
- if ($user->rights->adherent->supprimer) {
+ if ($user->hasRight('adherent', 'supprimer')) {
print ''.$langs->trans("Resiliate")."\n";
} else {
print ''.$langs->trans("Resiliate").''."\n";
@@ -1953,7 +1953,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
// Exclude
if (Adherent::STATUS_VALIDATED == $object->statut) {
- if ($user->rights->adherent->supprimer) {
+ if ($user->hasRight('adherent', 'supprimer')) {
print ''.$langs->trans("Exclude")."\n";
} else {
print ''.$langs->trans("Exclude").''."\n";
@@ -1962,7 +1962,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
// Create third party
if (isModEnabled('societe') && !$object->socid) {
- if ($user->rights->societe->creer) {
+ if ($user->hasRight('societe', 'creer')) {
if (Adherent::STATUS_DRAFT != $object->statut) {
print 'id).'&action=create_thirdparty" title="'.dol_escape_htmltag($langs->trans("CreateDolibarrThirdPartyDesc")).'">'.$langs->trans("CreateDolibarrThirdParty").''."\n";
} else {
@@ -1975,7 +1975,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
// Create user
if (!$user->socid && !$object->user_id) {
- if ($user->rights->user->user->creer) {
+ if ($user->hasRight('user', 'user', 'creer')) {
if (Adherent::STATUS_DRAFT != $object->statut) {
print 'id).'&action=create_user" title="'.dol_escape_htmltag($langs->trans("CreateDolibarrLoginDesc")).'">'.$langs->trans("CreateDolibarrLogin").''."\n";
} else {
@@ -1999,7 +1999,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
}
// Delete
- if ($user->rights->adherent->supprimer) {
+ if ($user->hasRight('adherent', 'supprimer')) {
print ''.$langs->trans("Delete").''."\n";
} else {
print ''.$langs->trans("Delete").''."\n";
@@ -2026,7 +2026,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
$filename = dol_sanitizeFileName($object->ref);
$filedir = $conf->adherent->dir_output.'/'.get_exdir(0, 0, 0, 1, $object, 'member');
$urlsource = $_SERVER['PHP_SELF'].'?id='.$object->id;
- $genallowed = $user->rights->adherent->lire;
+ $genallowed = $user->hasRight('adherent', 'lire');
$delallowed = $user->hasRight('adherent', 'creer');
print $formfile->showdocuments('member', $filename, $filedir, $urlsource, $genallowed, $delallowed, $object->model_pdf, 1, 0, 0, 28, 0, '', '', '', (empty($object->default_lang) ? '' : $object->default_lang), '', $object);
diff --git a/htdocs/adherents/document.php b/htdocs/adherents/document.php
index 37d6e72a97e..4517bee15c6 100644
--- a/htdocs/adherents/document.php
+++ b/htdocs/adherents/document.php
@@ -76,14 +76,14 @@ if ($id > 0 || !empty($ref)) {
$result = $object->fetch($id, $ref);
// Define variables to know what current user can do on users
- $canadduser = ($user->admin || $user->rights->user->user->creer);
+ $canadduser = ($user->admin || $user->hasRight('user', 'user', 'creer'));
// Define variables to know what current user can do on properties of user linked to edited member
if ($object->user_id) {
// $User is the user who edits, $object->user_id is the id of the related user in the edited member
- $caneditfielduser = ((($user->id == $object->user_id) && $user->rights->user->self->creer)
- || (($user->id != $object->user_id) && $user->rights->user->user->creer));
- $caneditpassworduser = ((($user->id == $object->user_id) && $user->rights->user->self->password)
- || (($user->id != $object->user_id) && $user->rights->user->user->password));
+ $caneditfielduser = ((($user->id == $object->user_id) && $$user->hasRight('user', 'self', 'creer'))
+ || (($user->id != $object->user_id) && $user->hasRight('user', 'user', 'creer')));
+ $caneditpassworduser = ((($user->id == $object->user_id) && $user->hasRight('user', 'self', 'password'))
+ || (($user->id != $object->user_id) && $user->hasRight('user', 'user', 'password')));
}
}
diff --git a/htdocs/adherents/list.php b/htdocs/adherents/list.php
index 394a650d7ee..2e54ed03db8 100644
--- a/htdocs/adherents/list.php
+++ b/htdocs/adherents/list.php
@@ -300,8 +300,8 @@ if (empty($reshook)) {
// Mass actions
$objectclass = 'Adherent';
$objectlabel = 'Members';
- $permissiontoread = $user->rights->adherent->lire;
- $permissiontodelete = $user->rights->adherent->supprimer;
+ $permissiontoread = $user->hasRight('adherent', 'lire');
+ $permissiontodelete = $user->hasRight('adherent', 'supprimer');
$permissiontoadd = $user->hasRight('adherent', 'creer');
$uploaddir = $conf->adherent->dir_output;
include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
@@ -614,13 +614,13 @@ $arrayofmassactions = array(
if ($user->hasRight('adherent', 'creer')) {
$arrayofmassactions['close'] = img_picto('', 'close_title', 'class="pictofixedwidth"').$langs->trans("Resiliate");
}
-if ($user->rights->adherent->supprimer) {
+if ($user->hasRight('adherent', 'supprimer')) {
$arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete");
}
-if (isModEnabled('category') && $user->rights->adherent->creer) {
+if (isModEnabled('category') && $user->hasRight('adherent', 'creer')) {
$arrayofmassactions['preaffecttag'] = img_picto('', 'category', 'class="pictofixedwidth"').$langs->trans("AffectTag");
}
-if ($user->hasRight('adherent', 'creer') && $user->rights->user->user->creer) {
+if ($user->hasRight('adherent', 'creer') && $user->hasRight('user', 'user', 'creer')) {
$arrayofmassactions['createexternaluser'] = img_picto('', 'user', 'class="pictofixedwidth"').$langs->trans("CreateExternalUser");
}
if (GETPOST('nomassaction', 'int') || in_array($massaction, array('presend', 'predelete', 'preaffecttag'))) {
@@ -661,7 +661,7 @@ if ($sall) {
// Filter on categories
$moreforfilter = '';
-if (isModEnabled('categorie') && $user->rights->categorie->lire) {
+if (isModEnabled('categorie') && $user->hasRight('categorie', 'lire')) {
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
$moreforfilter .= ' ';
$moreforfilter .= img_picto($langs->trans('Categories'), 'category', 'class="pictofixedlength"').$formother->select_categories(Categorie::TYPE_MEMBER, $search_categ, 'search_categ', 1, $langs->trans("MembersCategoriesShort"));
diff --git a/htdocs/adherents/note.php b/htdocs/adherents/note.php
index 938ab368ae1..4d3bc4dd638 100644
--- a/htdocs/adherents/note.php
+++ b/htdocs/adherents/note.php
@@ -59,14 +59,14 @@ if ($id > 0 || !empty($ref)) {
$result = $object->fetch($id, $ref);
// Define variables to know what current user can do on users
- $canadduser = ($user->admin || $user->rights->user->user->creer);
+ $canadduser = ($user->admin || $user->hasRight('user', 'user', 'creer'));
// Define variables to know what current user can do on properties of user linked to edited member
if ($object->user_id) {
// $User is the user who edits, $object->user_id is the id of the related user in the edited member
- $caneditfielduser = ((($user->id == $object->user_id) && $user->rights->user->self->creer)
- || (($user->id != $object->user_id) && $user->rights->user->user->creer));
- $caneditpassworduser = ((($user->id == $object->user_id) && $user->rights->user->self->password)
- || (($user->id != $object->user_id) && $user->rights->user->user->password));
+ $caneditfielduser = ((($user->id == $object->user_id) && $user->hasRight('user', 'self', 'creer'))
+ || (($user->id != $object->user_id) && $user->hasRight('user', 'user', 'creer')));
+ $caneditpassworduser = ((($user->id == $object->user_id) && $user->hasRight('user', 'self', 'password'))
+ || (($user->id != $object->user_id) && $user->hasRight('user', 'user', 'password')));
}
}
diff --git a/htdocs/adherents/type.php b/htdocs/adherents/type.php
index fcdb643a006..257e7266e5a 100644
--- a/htdocs/adherents/type.php
+++ b/htdocs/adherents/type.php
@@ -118,7 +118,7 @@ if ($cancel) {
}
}
-if ($action == 'add' && $user->rights->adherent->configurer) {
+if ($action == 'add' && $user->hasRight('adherent', 'configurer')) {
$object->label = trim($label);
$object->morphy = trim($morphy);
$object->status = (int) $status;
@@ -505,19 +505,19 @@ if ($rowid > 0) {
print ' ';
// Edit
- if ($user->rights->adherent->configurer) {
+ if ($user->hasRight('adherent', 'configurer')) {
print '';
}
// Add
- if ($user->rights->adherent->configurer && !empty($object->status)) {
+ if ($user->hasRight('adherent', 'configurer')&& !empty($object->status)) {
print '';
} else {
print '';
}
// Delete
- if ($user->rights->adherent->configurer) {
+ if ($user->hasRight('adherent', 'configurer')) {
print '';
}
@@ -758,7 +758,7 @@ if ($rowid > 0) {
if ($user->hasRight('adherent', 'creer')) {
print 'id).'">'.img_edit().'';
}
- if ($user->rights->adherent->supprimer) {
+ if ($user->hasRight('adherent', 'supprimer')) {
print ''.img_picto($langs->trans("Resiliate"), 'disable.png').'';
}
print " | ";
diff --git a/htdocs/adherents/type_translation.php b/htdocs/adherents/type_translation.php
index 33c93704b80..9539250cb44 100644
--- a/htdocs/adherents/type_translation.php
+++ b/htdocs/adherents/type_translation.php
@@ -190,7 +190,7 @@ print dol_get_fiche_end();
print "\n|