FR/ACL

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
Warning.png This page requires local translation. If page will remain not translated in reasonable period of time it would be deleted.
After translating the page completely, please remove the ‎{{translate}}‎ tag from the page.

MTA inclut une Liste de Contrôle d'Accès (ACL) qui vous permet de sécuriser et limiter l'accès aux fonctionnalités et commandes du serveur.

La clé du concept de l'ACL de MTA(et des ACLs en générale) est que l'on donne à un objet spécifique une liste de droits. Dans le cas de MTA, il y a deux types d'objets: des ressources or et des utilisateurs. Il y a de nombreux droits disponible dans MTA.

En bref, l'ACL définit quels fonctions une ressource ou un utilisateur peut effectuer. Cela peut évidemment être très utile pour par exemple empêcher tous les joueurs de votre serveur d'être en mesure de se bannir entre eux, ou d'empêcher vos nouvelles ressources non testées de faire de même.

Bien sûr, plus de pouvoir implique plus de responsabilité et il est très facile de faire buguer totalement une ressource - par exemple, désactiver la fonction spawnPlayer pour toutes les ressource serai une très mauvaise idée :). Evidemment vous pouvez vous retrouver dans un cas ou ce genre de manipulation est nécessaire - si vous voulez forcer toutes les ressources à utiliser une ressource spéciale pour faire spawn un joueur par exemple - mais c'est quand même un peu draconien.

Comprendre l'ACL

Il y a deux composants dans l'ACL: les groupes et les droits. Ils sont représentés comme ceci <group name=" "> et <acl name=" " /> respectivement. Leurs rôles sont:
1. Donner des permissions à des joueurs pour contrôler le serveur et utiliser les commandes des ressources. Exemples:

  • N'autoriser que les admins à utiliser la fonction giveWeapon de la ressource freeroam.
  • Autoriser tous les joueurs à démarrer une ressource.

2. Donner des permissions à des ressources pour avoir le droit d'utiliser des fonctions en interne et des fonctions d'autres ressources. Exemples:

  • Autoriser une ressource à utiliser la fonction restartResource.
  • Autoriser une ressource d'utiliser la fonction call pour utiliser les fonctions exportées d'autres ressources.

Groupes par défaut

MTA possède déjà des groupes avec des permissions de plus en plus élevées:

  • Everyone - Groupe qui concerne tout le monde
  • Moderator - Le groupe des Modérateurs
  • SuperModerator - Le groupe des Super Modérateurs
  • Admin - Le groupe des Admins
  • Console - Contrôle les droits pour les personnes qui utiliseront la console du serveur via <object name="user.Console" />
  • RPC - Remote Procedure Call. Accorde seulement l'accès à la fonction callRemote et désactive les commandes des ressources par défaut.

To explain further, I will use the Everyone group as an example. By default it looks like this:

    <group name="Everyone">
        <acl name="Default" />
        <object name="user.*" />
        <object name="resource.*" />
    </group>


You will first notice the acl name inside the group. It defines what permissions the group has. Users and resources in this group will have the permissions specified on the "Default" acl name list. Note: You will notice this group is special, in that it includes every user and resource by using a wildcard (*) where the user or resource name would be.

Now, scroll further down the ACL and you will see the <acl name="Default" /> listing. Note I have trimmed this list dramatically due to its length.

    <acl name="Default">
        <right name="command.start" access="false" />
        <right name="command.stop" access="false" />
        <right name="command.stopall" access="false" />
        ...etc etc...
        <right name="function.executeCommandHandler" access="false" />
        <right name="function.setPlayerMuted" access="false" />
        <right name="function.restartResource" access="false" />
        ...etc etc...
        <right name="general.adminpanel" access="false" />
        <right name="general.tab_players" access="false" />
        <right name="general.tab_resources" access="false" />
        ...etc etc...
        <right name="command.freeze" access="false" />
        <right name="command.shout" access="false" />
        <right name="command.spectate" access="false" />
        ...etc etc...
    </acl>


  • Function entries are MTA scripting functions. For example, if a resource needed to use restartResource and was only in the 'Everyone' group (with the 'Default' list), it would be denied access to restartResource and fail to work correctly.
  • Commands are created when a resource uses addCommandHandler. An example would be typing /createvehicle [vehicle] in the chatbox for the freeroam resource. This controls whether users in the group using this ACL can use the command. Note: commands have no effect on resources within the group. Commands are only related to users.
    • General is a custom right name group created by the admin resource but it works on the same principles. The script works with them by using hasObjectPermissionTo


You will notice some groups such as admin have multiple <acl name="" /> nodes. An example is the admin group:

    <group name="Admin">
        <acl name="Moderator" />
        <acl name="SuperModerator" />
        <acl name="Admin" />
        <acl name="RPC" />
        <object name="resource.admin" />
        <object name="resource.webadmin" />
        <object name="user.Ransom" />
    </group>

This gives all the permissions defined in each <acl name="" /> node in order of listing. So for example, the admin group makes sure all the permissions are given to admins by using all the lists. If there are any conflicts, the lowest entry wins. For example, pretend these 2 acls were in a group in the following order:

1. <acl name="Default"> sets <right name="general.ModifyOtherObjects" access="false" /> <br\> 2. <acl name="Admin"> sets <right name="general.ModifyOtherObjects" access="true" /> <br\> 3. For all users and resources in group admin: <right name="general.ModifyOtherObjects" access="true" /><br\> <br\>

Resource Groups and ACLs

You will notice there are some other groups that came with MTA. These were defined by resources that came with MTA. If a resource wants to designate specific ACL rights not provided by the default MTA groups, it can create its own ACL name and a group to use it. I will show AMX's entry as an example. AMX is designed to emulate SA-MP scripts and it needs a certain set of permissions that doesn't fit the default groups well. It is shown below:

    <group name="AMX">
        <acl name="AMX" />
        <object name="resource.amx" />
    </group>

    <acl name="AMX">
        <right name="general.ModifyOtherObjects" access="true" />
        <right name="function.startResource" access="true" />
        <right name="function.stopResource" access="true" />
        <right name="general.adminpanel" access="false" />
        ...etc etc...
        <right name="command.kick" access="false" />
        <right name="command.freeze" access="false" />
        <right name="command.mute" access="false" />
        ...etc etc...
    </acl>

Modifying the ACL

There are three ways you can modify the ACL - how you do it depends who you are.

HTTP Interface

You can use the webadmin http interface to modify the ACL in your web browser. This is by far the easiest way to do so. Just make sure the webadmin resource is started on your server and visit http://ServerIP:HttpPort/. You can then use the two sections - ACLs and Groups. ACLs allows you to create your Access Control Lists - lists of rights. Groups allow you to group together collections of users and assign ACLs to them. For example, the ACLs section allows you to specify that the Admin ACL has access to the start console command. You can the go to the Groups section and create an Admin group that has access to your Admin acl. You can then add users to your Admin group.

XML file

You can modify the ACL.xml file manually. This has a fairly straightforward syntax, but it can get a bit confusing at times. If you do it while the server is running, don't forget to call the scripting function aclReload ("start runcode", "run aclReload()") so the new ACL is loaded, or otherwise stop your server before modifying. This also prevents your changes from being accidentally overwritten by the server.

Scripting functions

You can use a large number of ACL scripting functions to modify the ACL on the fly. Of course, you can (and really should!) limit access to the ACL functions with the ACL. Note that the admin resource that comes with MTA can be used to manage the ACL from the resources tab. You must be setup as admin to use the admin panel. Click here for admin setup instructions.

See Also