Ares has a robust and flexible roles/permissions system. This article describes how you can utilize roles on your game.
Table of Contents
There are two levels to the Roles system: roles and permissions.
Roles are assigned to characters. You could have a ‘builder’ role or a ‘pilot’ role. Some things - like channels or forums - can be locked so that only people with certain roles can use them.
Permissions are assigned to roles, and allow you to further refine what people with a given role can do.
The default Ares database comes with several roles:
Additionally, there is a special character - the master admin (default name Headwiz). The master admin has both the admin and coder roles, and is the only one that can assign those roles.
Roles contain permissions, which control access to most commands. For example, the ‘home’ command is limited to people with the “go_home” permission. The ability to create and delete channels is limited to people with the “manage_channels” permission.
You cannot assign individual permissions to characters. Permissions may only be assigned to roles, which are in turn assigned to characters.
Characters with the Admin role automatically have access to all permissions.
Let’s say you wanted to create a more limited admin role for apps staff. You want them to have access to review and approve characters, access to read jobs in the APP category, and access to an Apps forum.
role/addpermission app_staff=<permission>. You probably want to give them things like
app_staffrole to the APP category. See the jobs configuration tutorial for details.
role/add <name>=approved. You should also mark them as player bits with the
playerbitcommand so they don’t show up on the character gallery.
In your code, permissions can restrict who can use commands. For example, if you wanted to lock the ‘home’ command to only people who have the ‘go_home’ permission, you would add the following error checker in the home command handler.
def check_can_go_home return "You are not allowed to do that." if !enactor.has_permission?("go_home") return nil end
Many plugins have helper methods to check for the necessary permission. For example:
|access_jobs||Characters with the admin role have access to all job categories, but you have to edit the jobs configuration to give access to other roles.|
|announce||By default this is given to all approved characters so storytellers can announce the start of events.|
|boot||By default this is given to all approved characters as part of the tools for managing trolls.|