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

Fix handling of root flags in RequirePermissionsOr #700

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

zonical
Copy link
Collaborator

@zonical zonical commented Dec 4, 2024

Addresses #699.

@zonical zonical requested a review from roflmuffin as a code owner December 4, 2024 07:53
Comment on lines +14 to +16
public override bool CanExecuteCommand(SteamID? steamID)
{
if (caller == null) return true;
if (AdminManager.PlayerHasCommandOverride(caller, Command))
if (steamID == null) return true;
Copy link
Contributor

Choose a reason for hiding this comment

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

is this reliable?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It should be. SteamID null checks are peppered throughout core AdminManager functions, including PlayerHasCommandOverride itself, and I haven't seen any bug reports these functions failing.

@@ -27,13 +27,15 @@ public BaseRequiresPermissions(params string[] permissions)
Command = "";
}

public virtual bool CanExecuteCommand(CCSPlayerController? caller)
public virtual bool CanExecuteCommand(SteamID? steamID)
Copy link
Owner

Choose a reason for hiding this comment

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

Is this a public API? We might need to keep the old prototype around for backwards compatibility, and then proxy it to the new method using caller.AuthorizedSteamID

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