feat(admintools): make admin operation flags configurable via cvars#156
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR introduces configurable admin permission flags in Zombie:Reloaded by adding new ConVars and using them in privilege checks, enabling server owners to adjust required SourceMod admin flags without recompiling.
Changes:
- Added
zr_permissions_flag_genericandzr_permissions_flag_configurationConVars and exposed getter helpers. - Replaced hardcoded flag checks for privileged operations with ConVar-driven flag resolution plus fallback defaults.
- Updated documentation and bumped patch version/date metadata.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| src/addons/sourcemod/scripting/zr/zombiereloaded.inc | Alters default admin-flag behavior by resolving a ConVar-derived flag when the default parameter is used. |
| src/addons/sourcemod/scripting/zr/zadmin.inc | Registers an additional sm_zadmin console command alias for opening the admin menu. |
| src/addons/sourcemod/scripting/zr/hgversion.h.inc | Bumps patch version and updates version date. |
| src/addons/sourcemod/scripting/zr/cvars.inc | Adds ConVar handles + accessors and creates the new permission-flag ConVars. |
| src/addons/sourcemod/scripting/zr/admintools.inc | Adds ZRResolveAdminFlag helper and uses it for configurable flag-based privilege checks. |
| README.md | Documents the new permission flag ConVars. |
| docs/index.html | Documents the new ConVars and updates the manual’s version header/date. |
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Introduce ZR_ADMINFLAG_USE_CVAR (view_as<AdminFlag>(-1)) as a sentinel to indicate the default behavior of resolving the generic admin flag from configured permissions. Change ZRIsClientAdmin's default parameter from Admin_Generic to the new sentinel and update the conditional to check for the sentinel before calling ZRResolveAdminFlag(CvarsGetPermissionFlagGeneric(), Admin_Ban). Also update parameter/docs to clarify the default resolution behavior.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR makes admin permission checks configurable by introducing two new cvars for flag-based authentication in Zombie:Reloaded.
What changed
Why
Previously, required flags for these two operation categories were hardcoded.
This change allows server owners to adapt permission requirements without recompiling.
Backward compatibility
Notes