Skip to content

feat(admintools): make admin operation flags configurable via cvars#156

Merged
Rushaway merged 7 commits into
masterfrom
admins-flags
Jun 25, 2026
Merged

feat(admintools): make admin operation flags configurable via cvars#156
Rushaway merged 7 commits into
masterfrom
admins-flags

Conversation

@Rushaway

Copy link
Copy Markdown
Member

Summary

This PR makes admin permission checks configurable by introducing two new cvars for flag-based authentication in Zombie:Reloaded.

What changed

  • Added two new cvars:
    • zr_permissions_flag_generic (default: d / ban)
    • zr_permissions_flag_configuration (default: i / config)
  • Replaced hardcoded admin flags in privilege checks with cvar-driven values.
  • Added safe fallback behavior:
    • invalid or empty cvar values fall back to existing defaults (d and i).
  • Updated documentation:
    • README cvar list
    • Admin authentication section in docs
    • Added SourceMod Levels reference from AlliedModders.

Why

Previously, required flags for these two operation categories were hardcoded.
This change allows server owners to adapt permission requirements without recompiling.

Backward compatibility

  • Fully backward compatible with previous behavior through default values and fallback logic.

Notes

  • Group-based authentication behavior is unchanged.
  • Only flag-based authentication paths are affected by the new cvars..

Copilot AI review requested due to automatic review settings June 19, 2026 05:32

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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_generic and zr_permissions_flag_configuration ConVars 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.

Comment thread src/addons/sourcemod/scripting/zr/zombiereloaded.inc
Comment thread src/addons/sourcemod/scripting/zr/admintools.inc Outdated
Comment thread docs/index.html Outdated
Comment thread docs/index.html Outdated
Comment thread docs/index.html
Rushaway and others added 3 commits June 19, 2026 07:47
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.
@Rushaway
Rushaway merged commit 564b23b into master Jun 25, 2026
6 checks passed
@Rushaway
Rushaway deleted the admins-flags branch June 25, 2026 14:51
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