Athenian Role Management
Overview
Product overview
Athenian Role Management (ARM) is a lightweight WordPress and WooCommerce role operations plugin for managing roles, capabilities, user assignment, audit controls, and role-based discount policy from a dedicated admin workspace.
The plugin is designed for sites where native WordPress role management is too limited for real operational use: custom staff workflows, wholesale or member pricing, staging-to-production role migration, bulk customer role updates, and Athenian Platform pricing compatibility.
Rather than treating roles as a hidden technical setting, ARM turns role governance into a structured admin workflow. Operators can create, clone, rename, delete, import, export, and audit role definitions, while WooCommerce teams can define scoped percentage discounts by role and expose those decisions to Athenian pricing layers.
---
Use cases
- Wholesale and member roles
- Staff capability governance
- Staging-to-production role migration
- Role-based WooCommerce pricing
Developer
Developer starting point
This baseline was generated from the local athenian-role-management source folder and the linked product record. The source folder is the reviewed implementation boundary for this pass; runtime behavior and repository commit identity should be reconciled before treating this as release-grade API reference.
Technical Architecture
Bootstrap Flow
The main plugin file defines constants and loads the core classes:
define( 'ARM_VERSION', '0.2.1' );
define( 'ARM_FILE', __FILE__ );
define( 'ARM_DIR', plugin_dir_path( __FILE__ ) );
define( 'ARM_URL', plugin_dir_url( __FILE__ ) );On plugins_loaded, the plugin boots:
Athenian\RoleManagement\PluginAthenian\RoleManagement\Role_DiscountsAthenian\RoleManagement\Admin\Role_Discounts_AdminAthenian\RoleManagement\REST\Rest_Role_Discount_Endpoint
Main Classes
| Class | Namespace | Responsibility | |---|---|---| | Plugin | Athenian\RoleManagement | Core loader, activation defaults, admin/AJAX dependency loading. | | Admin | Athenian\RoleManagement | Registers the Role Management admin menu, enqueues admin assets, adds plugin action links. | | Admin_Page | Athenian\RoleManagement | Renders the main Users → Role Management screen and JSON bootstrap payload. | | Ajax | Athenian\RoleManagement | Handles role lifecycle, capability updates, user search, user assignment, import/export, audit, and settings AJAX. | | Util | Athenian\RoleManagement\Lib | Capability checks, nonce utilities, role accessors, sanitization, capability grouping, audit logging. | | Role_Discounts | Athenian\RoleManagement | Stores, normalizes, resolves, and exposes role discount rules. | | Role_Discounts_Admin | Athenian\RoleManagement\Admin | Renders WooCommerce Role Discounts admin page and AJAX product/term search. | | Rest_Role_Discount_Endpoint | Athenian\RoleManagement\REST | Registers legacy /ath-pricing/v1/role-discount endpoint. |
File Structure
athenian-role-management.php
includes/
class-arm-plugin.php
class-role-discounts.php
lib/
util.php
admin/
class-admin.php
class-admin-page.php
class-ajax.php
class-role-discounts-admin.php
rest/
class-rest-role-discount-endpoint.php
assets/
admin.css
admin.js
admin/
arm-admin.css
arm-admin.js
docs/
athenian-role-management-marketing-document.md
athenian-platform-marketing.md
athenian-platform-technical.mdSyntax Review
A PHP lint pass was run against all PHP files in the ZIP. No syntax errors were reported.
---
WordPress Hooks and Integration Points
Actions
| Hook | Purpose | |---|---| | plugins_loaded | Boots plugin services after WordPress plugins load. | | admin_menu | Adds Role Management and Role Discounts admin pages. | | admin_enqueue_scripts | Enqueues CSS/JS for admin screens. | | admin_init | Registers settings and handles Role Discounts save submissions. | | rest_api_init | Registers the legacy role-discount REST route. |
AJAX Actions
| AJAX Action | Purpose | |---|---| | arm_get_roles | Return roles, capability groups, and settings. | | arm_create_role | Create a new role, optionally from a base role. | | arm_clone_role | Clone an existing role to a new role key/name. | | arm_rename_role | Rename an existing role. | | arm_delete_role | Delete a non-protected role. | | arm_update_caps | Replace a role’s capability map with the selected grants. | | arm_search_users | Search users by login, email, or display name. | | arm_apply_role | Add or replace roles for selected users. | | arm_export | Export role definitions as arm_roles_v1 JSON. | | arm_import | Import role definitions in merge or replace mode. | | arm_get_audit | Return recent audit entries. | | arm_clear_audit | Clear the audit log. | | arm_save_settings | Save audit and safety settings. | | arm_role_discount_search_products | Search products/variations for discount targeting. | | arm_role_discount_search_terms | Search product categories or tags for discount targeting. |
Filters
| Filter | Purpose | |---|---| | ath/apc/role_discount_for_price | Canonical Athenian Platform role-discount lookup used by pricing consumers. | | plugin_action_links_{plugin} | Adds an “Open” link from the Plugins screen to the Role Management admin page. |
REST Route
| Route | Method | Authentication | Purpose | |---|---|---|---| | /wp-json/ath-pricing/v1/role-discount | GET | Logged-in users only | Returns the current user’s roles and resolved discount. |
---
Data Model and Storage
Options
| Option | Purpose | |---|---| | arm_settings | Stores audit and danger-confirmation settings. | | arm_audit_log | Stores recent audit entries. | | arm_role_discounts_v2 | Preferred scoped role-discount rules. | | arm_role_discounts | Legacy v1 role-to-percent discount map. | | ath_pricing_tiers_role_discounts | Legacy fallback discount option. | | apt_role_discounts | Legacy Athenian Pricing Tiers fallback discount option. |
Role Export Format
ARM exports role definitions with this top-level structure:
{
"format": "arm_roles_v1",
"site": {
"url": "https://example.com",
"name": "Example Site",
"generated_at": "2026-07-01T00:00:00+00:00"
},
"roles": {
"custom_role": {
"name": "Custom Role",
"capabilities": {
"read": true,
"upload_files": true
}
}
}
}Role Discount v2 Rule Shape
[
'wholesale_customer' => [
'enabled' => true,
'percent' => 10.0,
'priority' => 50,
'scope' => [
'include' => [
'products' => [123],
'categories' => [10],
'tags' => [7],
],
'exclude' => [
'products' => [],
'categories' => [],
'tags' => [],
],
],
],
]Scope Behavior
- Exclude rules always win.
- Product ID and parent product ID are both considered.
- Product category and product tag matches check both the product and parent product where relevant.
- If no include buckets are configured, the rule behaves as a global rule unless excluded.
- If any include bucket is configured, the product must match at least one include bucket.
---
Security and Permissions
Main Role Management Permissions
The main role management UI is added under the Users menu with the promote_users capability. Internal permission checks allow users who can either manage_options or promote_users.
Role Discount Permissions
The WooCommerce role-discount screen requires:
manage_woocommerceThe discount product and term search AJAX handlers also require manage_woocommerce and validate a dedicated nonce.
Request Protection
- Admin AJAX actions validate the
arm_noncenonce. - Role Discount save actions use
check_admin_referer(). - REST discount lookup requires
is_user_logged_in(). - Input values are sanitized using WordPress helpers such as
sanitize_key(),sanitize_text_field(),wp_unslash(), and normalization methods. - The
administratorrole is protected from deletion by the plugin UI/API.
Safety Notes
Role/capability editors can affect access to the site. ARM includes a danger-confirmation setting and audit logging, but production operators should still test role changes carefully in staging before applying them to critical admin roles.
---
WooCommerce and Athenian Platform Integration
WooCommerce Integration
ARM integrates with WooCommerce primarily through the Role Discounts admin screen and product/taxonomy-aware discount scoping.
The plugin can search and target:
- Products.
- Product variations.
- Product categories.
- Product tags.
The role-discount logic does not appear to directly replace WooCommerce price display or cart totals by itself. Instead, it exposes a discount decision through the Athenian filter contract so a pricing layer such as Athenian Platform Core / PriceDelegate can consume the result and apply pricing behavior consistently.
Athenian Platform Compatibility
ARM preserves compatibility with Athenian pricing flows through:
ath/apc/role_discount_for_priceand:
/wp-json/ath-pricing/v1/role-discountThis allows ARM to operate as a focused role-discount policy source while broader pricing plugins decide how and where to apply the resolved discount.
Legacy Pricing Compatibility
ARM checks multiple storage locations for legacy role-discount definitions:
arm_role_discountsath_pricing_tiers_role_discountsapt_role_discounts
That makes the plugin useful in environments migrating from earlier Athenian Pricing Tiers or custom role-discount implementations.
---
Implementation Notes and Caveats
- The main plugin is version
0.2.1. - The primary role-management screen is registered under the Users menu as
users.php?page=athenian-role-management. - The Role Discounts page is registered under WooCommerce as
admin.php?page=arm-role-discounts. - The Role Discounts system stores preferred v2 rules in
arm_role_discounts_v2while retaining legacy fallback behavior. - The plugin exposes role discounts through a filter and REST endpoint; direct price replacement/cart recalculation should be handled by a consuming pricing layer.
- The role import flow can rename existing roles and merge or replace capabilities, so imports should be tested before production use.
- Capability updates remove all existing caps for a role and then re-add the submitted grants. This makes the submitted capability map authoritative.
- The
administratorrole is protected from deletion, but administrators should still be careful when editing capabilities for high-privilege roles. - A PHP lint pass found no syntax errors in the included PHP files.
---
Install
- Reviewed source folder: athenian-role-management
- Plugin version reviewed: 0.2.3
- Local source inventory: 150 files (vendor, temporary, and test fixtures excluded).
- WordPress role and capability APIs.
- WooCommerce for role-discount integration.
- Athenian Platform Core can consume the role-discount filter when configured.
Configuration
- Technical Architecture — see the linked technical reference excerpt.
- WordPress Hooks and Integration Points — see the linked technical reference excerpt.
- Data Model and Storage — see the linked technical reference excerpt.
- Security and Permissions — see the linked technical reference excerpt.
- WooCommerce and Athenian Platform Integration — see the linked technical reference excerpt.
- Implementation Notes and Caveats — see the linked technical reference excerpt.
Usage
- Shortcodes detected in local PHP source: 1
- Static action/filter hooks detected in local PHP source: 36
- REST route registrations detected in local PHP source: 1
Shortcodes
- role_discount_display — includes/class-role-discounts.php
REST Endpoints
- ath-pricing/v1 — includes/rest/class-rest-role-discount-endpoint.php
Hooks
- admin_enqueue_scripts — includes/admin/class-admin.php
- admin_enqueue_scripts — includes/admin/class-role-discounts-admin.php
- admin_init — includes/admin/class-role-discounts-admin.php
- admin_init — includes/class-role-discounts.php
- admin_menu — includes/admin/class-admin.php
- admin_menu — includes/admin/class-role-discounts-admin.php
- admin_menu — includes/class-athenian-license-client.php
- admin_notices — includes/class-athenian-license-client.php
- admin_post_ — includes/class-athenian-license-client.php
- ath/apc/role_discount_for_price — includes/class-role-discounts.php
- edit_user_profile_update — includes/admin/class-admin.php
- edit_user_profile — includes/admin/class-admin.php
- personal_options_update — includes/admin/class-admin.php
- plugins_api — includes/class-athenian-license-client.php
- plugins_loaded — athenian-role-management.php
- plugin_action_links_ — includes/admin/class-admin.php
- rest_api_init — includes/rest/class-rest-role-discount-endpoint.php
- show_user_profile — includes/admin/class-admin.php
- update_plugins_athenianbrands.com — includes/class-athenian-license-client.php
- user_new_form — includes/admin/class-admin.php
- user_register — includes/admin/class-admin.php
- wp_ajax_arm_apply_role — includes/admin/class-ajax.php
- wp_ajax_arm_clear_audit — includes/admin/class-ajax.php
- wp_ajax_arm_clone_role — includes/admin/class-ajax.php
- wp_ajax_arm_create_role — includes/admin/class-ajax.php
- wp_ajax_arm_delete_role — includes/admin/class-ajax.php
- wp_ajax_arm_export — includes/admin/class-ajax.php
- wp_ajax_arm_get_audit — includes/admin/class-ajax.php
- wp_ajax_arm_get_roles — includes/admin/class-ajax.php
- wp_ajax_arm_import — includes/admin/class-ajax.php
- wp_ajax_arm_rename_role — includes/admin/class-ajax.php
- wp_ajax_arm_role_discount_search_products — includes/admin/class-role-discounts-admin.php
- wp_ajax_arm_role_discount_search_terms — includes/admin/class-role-discounts-admin.php
- wp_ajax_arm_save_settings — includes/admin/class-ajax.php
- wp_ajax_arm_search_users — includes/admin/class-ajax.php
- wp_ajax_arm_update_caps — includes/admin/class-ajax.php
Data Model
- WordPress Hooks and Integration Points — described in the local technical reference.
- Data Model and Storage — described in the local technical reference.
- WooCommerce and Athenian Platform Integration — described in the local technical reference.
API Reference
- Local source digest: 929916103f678dde5eca796e6d62b81aafe06c08580ecdffc487bfe3eef63089
- Repository URL: https://github.com/Athenian-Brands/athenian-role-management
- Repository reference: main
- Repository commit: b1e37143fb0a538d6d270915e2535bad6e55446a
Source files include: .git/COMMIT_EDITMSG, .git/FETCH_HEAD, .git/HEAD, .git/config, .git/description, .git/hooks/applypatch-msg.sample, .git/hooks/commit-msg.sample, .git/hooks/fsmonitor-watchman.sample, .git/hooks/post-update.sample, .git/hooks/pre-applypatch.sample, .git/hooks/pre-commit.sample, .git/hooks/pre-merge-commit.sample, .git/hooks/pre-push.sample, .git/hooks/pre-rebase.sample, .git/hooks/pre-receive.sample, .git/hooks/prepare-commit-msg.sample, .git/hooks/push-to-checkout.sample, .git/hooks/sendemail-validate.sample, .git/hooks/update.sample, .git/index, .git/info/exclude, .git/logs/HEAD, …
Troubleshooting
- This is a published baseline generated from local source documentation and the linked WooCommerce product record.
- Confirm the deployed plugin version, active dependencies, and current repository tree before using implementation details as a release contract.
- Treat pricing, payment, vendor, shipment, inventory, and external-provider behavior as integration-dependent until exercised in the target environment.
- The local source checkout is the baseline; add a verified repository URL and commit if the source is later reconciled to a canonical GitHub tree.
FAQ
What is this page intended to establish?
A versioned, product-linked starting point for iterative developer documentation. It combines the local implementation reference with a compact detected-code inventory so later passes can refine exact contracts.
Is the linked repository commit verified?
No. This baseline was generated from the named local source folder because the checkout did not expose a Git repository identity. Add the verified repository URL and commit in the next enrichment pass.