Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] @domain/root flag does not work with RequiresPermissionsOr annotation #699

Open
rothadamcz opened this issue Dec 2, 2024 · 2 comments
Labels
area-Admin bug Something isn't working

Comments

@rothadamcz
Copy link

rothadamcz commented Dec 2, 2024

When admin has @domain/root flag, it is ignored when using RequiresPermissionsOr annotation.

Example

  • Admin has only 1 flag (@css/root)
  • He is not able to execute css_ban (command implementation bellow), because he does not have @css/ban nor @something/else flag.
public override void Load(bool hotReload)
{
    AddCommand("css_ban", "Ban a player", OnCommand);
}

[RequiresPermissionsOr("@css/ban", "@something/else")]
[CommandHelper(minArgs: 1, usage: "[id]", whoCanExecute: CommandUsage.CLIENT_ONLY)]
public static void OnCommand(CCSPlayerController? caller, CommandInfo info)
{
    if (caller == null) return;

    info.ReplyToCommand("Hello World!");
}

Confirmed on API version: v291 (1.0.291+6349c11)

@github-actions github-actions bot added the untriaged New issue has not been triaged label Dec 2, 2024
@rothadamcz
Copy link
Author

rothadamcz commented Dec 3, 2024

To clarify,
I think the intended behavior should be that access to the command should be granted, because required permission is @css/ban OR @something/else and since admin has @css/root which enables all @css flags including @css/ban, the requirement is met.

@rothadamcz rothadamcz changed the title [BUG] @css/root flag does not work with RequiresPermissionsOr annotation [BUG] @domain/root flag does not work with RequiresPermissionsOr annotation Dec 3, 2024
@zonical zonical added bug Something isn't working area-Admin and removed untriaged New issue has not been triaged labels Dec 3, 2024
@zonical
Copy link
Collaborator

zonical commented Dec 3, 2024

Kia ora! I've been able to replicate the bug in the test suite, and I've found the cause of the issue in the code (which I wrote ages ago).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-Admin bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants