CommandPermissionChecker

public protocol CommandPermissionChecker

Check if the given user has the permission to execute the command.

let checker = MyChecker()
guard checker.check(user, canUse: command, on: event) else { throw CommandError.InvalidPermissions }
  • Check if the given user has the permission to execute the command.

    let checker = MyChecker()
    guard checker.check(user, canUse: command, on: event) else { throw CommandError.InvalidPermissions }
    

    Declaration

    Swift

    func check(_ user: Userable, canUse command: _ExecutableCommand, on event: CommandEvent) -> Bool

    Parameters

    user

    User executing the command

    command

    Command being executed

    event

    Event holding the command & related info

    Return Value

    Wether or not the user is allowed to execute the command