Skip to content

Conversation

ELDment
Copy link
Contributor

@ELDment ELDment commented Oct 7, 2025

Description

Implement permission requirements for commands.

Type of Change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Code refactoring (no functional changes)
  • Performance improvement
  • Test coverage improvement
  • Build/CI improvement

Related Issues

Fixes #(issue number)
Closes #(issue number)
Related to #(issue number)

Changes Made

  • Native changes (C++)
  • Managed Changes (C#)
  • API additions/modifications
  • Memory management improvements
  • Network handling changes
  • SDK updates
  • Build system changes

Detailed Changes

List the specific changes made:

  • Added permissions parameter to Command attribute constructor
  • Extended ICommandService.RegisterCommand method to accept permission requirements

Testing

Test Environment

  • OS: Windows 11
  • Game: Counter-Strike 2

Test Cases

Describe the test cases you've run:

  1. Commands without permissions work normally for all users
  2. Commands with permissions ([Command("tt6", permissions: "tt6")]) properly check user permissions
  3. Users without required permissions receive "You do not have permission to use this command." message
  4. Users with required permissions can execute restricted commands successfully

Breaking Changes

List any breaking changes and migration steps:

  • CommandService constructor now requires IPlayerManagerService and IPermissionManager parameters

Performance Impact

  • No performance impact
  • Positive performance impact
  • Negative performance impact (explain below)
  • Performance impact unknown

Details: Permission checking only occurs when commands are executed, with minimal overhead.

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

Screenshots/Videos (if applicable)

image image

Additional Notes

This feature enhances server security by allowing administrators to control command access. The implementation is backward-compatible, with empty permission strings allowing unrestricted access to maintain existing functionality.


For Maintainers

  • Code review completed
  • Tests pass
  • Ready to merge

@skuzzis
Copy link
Member

skuzzis commented Oct 7, 2025

LGTM, once workflow is good it's gonna get merged

@ELDment
Copy link
Contributor Author

ELDment commented Oct 7, 2025

Looks like it's good to go, hmm,,, at least the managed build successfully

Copy link
Collaborator

@samyycX samyycX left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@samyycX samyycX merged commit a0873dd into swiftly-solution:beta Oct 7, 2025
6 of 7 checks passed
@ELDment ELDment deleted the minebeta1 branch October 8, 2025 03:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants