Skip to content

Permissions

Axwabo edited this page Apr 19, 2025 · 1 revision

Permissions

The following built-in attributes from the Axwabo.CommandSystem.Permissions namespace can be added to a command or a Remote Admin Option:

  • StringPermissionsAttribute
  • VanillaPermissionsAttribute
  • OneOfVanillaPermissionsAttribute
  • AllVanillaPermissionsAttribute

Multiple permission attributes can be specified, and if there is more than one, they will be combined into a AllPermissionChecker which ensures that all permissions are present.

You can also specify a required permission by creating your own permission checker and overriding the Permissions property on a command or a Remote Admin Option. The resolved permission checker can be queried using base.Permissions

Note

Attribute-based permissions won't be resolved if the instance implements the IPermissionChecker interface. In this scenario, the Permissions property will be set to the instance itself.

Custom Checkers

The IPermissionChecker interface contains a CheckPermission method that takes in a CommandSender and returns a CommandResult

If the returned result's Succeeded field is false, that signifies a failed permission check.

Attribute resolvers can be used to add permission checkers to a command.

The AnyPermissionChecker can be used to manually create a permission checker that matches any of the given instances.

Built-in, attribute-based and resolved permissions along with the command instance (if it implements IPermissionChecker) are aggregated. The return value of BaseCommandPropertyManager.ResolvePermissionChecker is:

Checker Count Return Value
0 null
1 The one permission checker
Any other An AllPermissionChecker with all checkers
Clone this wiki locally