Difference between revisions of "Permissions En"

From Dolibarr ERP CRM Wiki
Jump to navigation Jump to search
(Created page with '{{TemplateDocDevEn}} {{ToTranslate}} Chaque permission se voit affecter un id unique. Toutes les permissions gérées dans Dolibarr sont stockées dans la [[Table llx_rights_def...')
 
m (Import interlang links (links to translated versions of this page in other languages) from Multi Language Manager table.)
 
(18 intermediate revisions by one other user not shown)
Line 1: Line 1:
 +
<!-- BEGIN origin interlang links -->
 +
<!-- You can edit this section but do NOT remove these comments
 +
    Links below will be automatically replicated on translated pages by PolyglotBot -->
 +
[[es:Permisos]]
 +
[[fr:Permissions]]
 +
[[zh:用户权限]]
 +
<!-- END interlang links -->
 +
 +
[[Category:Core]]
 
{{TemplateDocDevEn}}
 
{{TemplateDocDevEn}}
{{ToTranslate}}
 
  
Chaque permission se voit affecter un id unique.
+
Each permission has a unique ID.
Toutes les permissions gérées dans Dolibarr sont stockées dans la [[Table llx_rights_def]] et possède un id.
+
All permissions managed by Dolibarr are saved into [[Table llx_rights_def]] and has its own ID.
Cet id est aussi utilisé pour faire le lien entre un utilisateur et la permission (liens stockés dans la table [[Table llx_user_rights]] ou pour faire un lien entre un groupe et la permission (liens stockés dans la table [[Table llx_usergroup_rights]]).
+
This id is used to make link between a user and the permission (links are saved into [[Table llx_user_rights]] or to make link between group and the permission (links are saved into the [[Table llx_usergroup_rights]]).
 +
 
 +
 
 +
 
  
== Récuperer les droits et groupes d'un utilisateur ==
+
= Get permission and groups of a user =
Dans une page de code Dolibarr, l'objet global $user est automatiquement défini.
+
In the source code of a Dolibarr page, the global object $user is automatically defined.
Il contient les informations sur l'utilisateur courant.
+
It contains all informations of the current user.
Ces droits sont accessibles par un test
+
Its permissions can be tested by a test
<pre>if ($user->rights->module->droit)</pre>
+
<source lang="php">
 +
if ($user->rights->module->codestringlevel1->codestringlevel1)
 +
</source>
  
Pour connaitre les groupes auxquels un utilisateur appartient, on peut utiliser le code suivant (Dolibarr 2.5 ou plus):
+
To know list of groups in which a user is, you can use the following code (Dolibarr 2.5 or more):
<pre>
+
<source lang="php">
 
$usergroup=new UserGroup($db);
 
$usergroup=new UserGroup($db);
 
$listofgroups=$usergroup->listGroupsForUser($fuser);
 
$listofgroups=$usergroup->listGroupsForUser($fuser);
 
print $listofgroups[0]->nom;
 
print $listofgroups[0]->nom;
</pre>
+
</source>
$listofgroups étant un tableau de tous les objets UserGroups (les groupes) auquels appartient l'utilisateur $fuser, $fuser étant un objet User.
+
$listofgroups is an array of all objects UserGroups (the groups) where the user $fuser belongs to
 
+
and $fuser is the object User loaded with code
Avant de créer de nouvelles permissions les développeurs doivent compléter ce document, c'est lui et lui seul qui fait office de réservation et d'inventaire des identifiants retenus.
+
<source lang="php">
 
+
$fuser=new User($db);
Identification des classes :
+
$fuser->fetch('login');
 +
</source>
  
== Tableau d'identification des classes ==
+
= Array of available permissions =
 +
Each module has its code string to use the $user->rights array to get its related permissions for user. List of code to use to read permissions are available of module developer documentation.
  
# [[Module Utilisateurs]]
+
Click [[:Category:List of Modules|here to get full list of modules]] (and choose the developer version of module documentation to get list of possible permissions).
# [[Module Facture]]
 
# [[Module Propositions commerciales]]
 
# [[Module Produits]]
 
# [[Module Projets]]
 
# [[Module Fiches d'intervention]]
 
# [[Module Adhérents]]
 
# [[Module Commandes]]
 
# [[Module Comptabilité]]
 
# [[Module Expédition]]
 
# [[Module Banque-Caisse]]
 
# [[Module Société]]
 
# [[Module Prélèvements bancaires]]
 
# [[Module Contrat]]
 
# [[Module Mailing]]
 
# [[Module Fournisseur]]
 
# [[Module Fournisseur]] commandes
 
# [[Module Fournisseur]] factures
 
# [[Module Catégorie]]
 
# [[Module Commercial]]
 
# [[Module Téléphonie]]
 
# [[Module Téléphonie]] lignes
 
# [[Module Téléphonie]] lignes ADSL
 
# [[Module Téléphonie]] contrats de lignes téléphonique
 
# [[Module Téléphonie]] permissions supplémentaires
 
# [[Module Téléphonie]] Services
 
# [[Module Téléphonie]] Tarifs
 

Latest revision as of 13:21, 23 July 2019

Each permission has a unique ID. All permissions managed by Dolibarr are saved into Table llx_rights_def and has its own ID. This id is used to make link between a user and the permission (links are saved into Table llx_user_rights or to make link between group and the permission (links are saved into the Table llx_usergroup_rights).



Get permission and groups of a user

In the source code of a Dolibarr page, the global object $user is automatically defined. It contains all informations of the current user. Its permissions can be tested by a test

if ($user->rights->module->codestringlevel1->codestringlevel1)

To know list of groups in which a user is, you can use the following code (Dolibarr 2.5 or more):

$usergroup=new UserGroup($db);
$listofgroups=$usergroup->listGroupsForUser($fuser);
print $listofgroups[0]->nom;

$listofgroups is an array of all objects UserGroups (the groups) where the user $fuser belongs to and $fuser is the object User loaded with code

$fuser=new User($db);
$fuser->fetch('login');

Array of available permissions

Each module has its code string to use the $user->rights array to get its related permissions for user. List of code to use to read permissions are available of module developer documentation.

Click here to get full list of modules (and choose the developer version of module documentation to get list of possible permissions).