Roles and Permissions
Verza's platform includes a roles and permissions system that can be integrated with the commands and actions to control access. Roles are used to group players based on their permissions, and permissions are used to control what actions players can perform. This allows for fine-grained control over who can use which commands and access certain features of the platform, as well as custom logics via player.hasAccess
or player.hasRole
.
Managing Roles
To manage roles, go to the Roles
tab from the Server Settings
. From there, you can create new roles, edit existing ones, and assign roles to players.
You can also assign roles to players via scripts using the player.addRole
and player.removeRole
methods from a server script.
Please note that roles can only be created from the Server Settings UI
and cannot be created via scripts at the moment.
Managing Permissions
In Verza, permissions for commands and actions are defined by the name of the command or action itself. For example, if you create a command called admin
, the permission required to access that command will also be called admin
.
To manage permissions, go to the Commands & Actions
tab from from the Server Settings
.
Once you're in the Server Settings UI
, click on the Commands & Actions
tab to see a list of all the available commands. For each command, you can assign a specific role that is required to access it. This means that only players with that role will be able to use the command.
To assign a role to a command, simply click on the role dropdown next to the command and select the desired role from the list. You can assign multiple roles to a command if you want to allow multiple groups of players to access it.
You can also assign roles to players from the Members
tab:
Commands vs Actions
Commands
and Actions
are both ways to define player interactions in Verza. Commands
are messages prefixed with a slash (/
) in the chat that trigger predefined functionality, while Actions
are used to grant or restrict access to certain functionality programmatically.
For example:
Command: /kick player1
- Kicks player1
from the server.
Actions: player.hasAccess('+miner')
- Checks if the player has access to the +miner
action.
Think of Commands
as something that players can trigger directly, while Actions
are used to control access to functionality based on a player's assigned roles.
You can check if a player has access to a specific command or action using the player.hasAccess
method.
Commands
Commands are created using the Command
class, and can be registered with the commands.register
method. Commands
are identified by a unique name, and can be executed by players by typing the name preceded by a slash (/
) in the chat like so: /fireworks
.
Actions
Actions
are not triggered by players directly, but are used to grant or restrict access to functionality based on a player's assigned roles. Actions are essentially just permissions that can be checked using the player.hasAccess
method. For example, if a player has been assigned the admin
role, which grants access to the +kick
action, they can use the player.hasAccess('+kick')
method to check if they have permission to kick another player.
Conclusion
In conclusion, commands are used to trigger predefined functionality, while actions are used to control access to functionality based on a player's assigned roles.
Special Admin Role
The Admin
role is a special role that is automatically created when you create a new server. This role is assigned to the server owner by default and has the name Owner
, it grants access to specific server-side-only actions from the client.
You can identify the Admin
special role by its tag along with the Admin
name like in the following screenshot.
By default the name of the role is Owner
, you can change it to whatever you want, however the role will always be Admin
.
As mentioned above, the Admin
role grants access to specific server-side-only actions from the client. These actions are listed below:
Player
Action | Description |
---|---|
player.ban | Bans the player. |
player.unban | Unbans the player. |
player.getBanStatus | Gets the player's ban status. |
player.kick | Kicks the player. |
Storage
Action | Description |
---|---|
Persistent Store | Allows the player to access a persistent store. |
Memory Store | Allows the player to access a memory store. |
Voicechat
Action | Description |
---|---|
voicechat.setEnabled | Sets the global voicechat status. |
voicechat.setMode | Sets the global voicechat mode. |
voicechat.setDistance | Sets the global voicechat distance. |
Chat
Action | Description |
---|---|
chat.setEnabled | Enables or disables the chat for the server. |
Player
Action | Description |
---|---|
player.voicechat.setMuted | Sets the voicechat muted status for the player. |
Players
Action | Description |
---|---|
players.setNametagsDistance | Sets the nametags distance for all players. |
players.setStreamerDistance | Sets the streamer distance for all players. |
Special Actions
There are certain actions that are automatically created when you create a new server.
This will help to access certain server-side actions from the client when the player has access to these actions.
These actions are listed below:
Objects
Action | Action | Description |
---|---|---|
object.sync | +editor | Synchronizes an object's properties between the server and the client. |
object.save | +editor | Saves an object to the Verza servers, making it permanent. |
object.saveVolatile | +editor | Same as object.save but with a delay. |
object.delete | +editor | Destroys and deletes an object from Verza servers (only for permanent objects). |
object.destroy | +editor | Destroys an object. |