Roles final class
Minn\Auth\Roles · public/minn/src/Minn/Auth/Roles.php · 68 lines
Role definitions from the site's {prefix}user_roles option, parsed by a bounded scan of the serialized blob, with the seeded contract copy as the fallback for a fresh install.
Constants and properties
| private | LEVELS = array ( 'administrator' => 10, 'editor' => 7, 'author' => 2, 'contributor' => 1, 'subscriber' => 0, ) | |
| private | ?array $roles | |
| private | readonly Minn\Db $db | Promoted from the constructor. |
Public
| new | __construct(Minn\Db $db)# | |
| static | level(string $role): int# | The wp_user_level stored beside the capabilities meta. |
| static | serializeSingle(string $role): string# | The {role: true} capabilities meta in its serialized form. |
| method | forget(): void# | Drops the parsed map so the next read sees a rewritten option. |
| method | all(): array# | Every role with its name and capabilities, from the option or the shipped defaults. |
| static | parse(?string $blob): ?array# | Each role is a string key over a two-entry array of "name" and "capabilities"; the capabilities map is {cap: bool}. Null when the blob has another shape, so the caller can fall back. |
Nothing matches.