API / Minn\Admin / PreferencesController

PreferencesController final readonly class

Minn\Admin\PreferencesController · public/minn/src/Minn/Admin/PreferencesController.php · 133 lines

A person's own settings in minn-admin/v1: their appearance, the views they hid, and an administrator's reach into another person's, for the user edit page. While Minn Admin runs as code, hiding is the plugin's own routes': only its registry knows the surfaces, editor panels, design sources and slash namespaces its adapters add.

Used by 1

Constants and properties

privatereadonly Minn\Admin\Appearance $appearance

Promoted from the constructor.

privatereadonly Minn\Admin\HiddenIntegrations $hiddenIntegrations

Promoted from the constructor.

privatereadonly Minn\Rest\Caller $caller

Promoted from the constructor.

Public

new__construct(Minn\Admin\Appearance $appearance, Minn\Admin\HiddenIntegrations $hiddenIntegrations, Minn\Rest\Caller $caller)#
methodmyAppearance(Minn\Http\Request $request): Minn\Http\ResponseGET /minn-admin/v1/me/appearance (floor edit_posts)#

The caller's appearance.

methodsaveMyAppearance(Minn\Http\Request $request): Minn\Http\ResponsePOST /minn-admin/v1/me/appearance (floor edit_posts)#

Saves the caller's appearance.

methoduserAppearance(Minn\Http\Request $request, string $id): Minn\Http\ResponseGET /minn-admin/v1/users/{id:\d+}/appearance (cap edit_user on {id})#

A user's appearance, for one who may edit them.

methodsaveUserAppearance(Minn\Http\Request $request, string $id): Minn\Http\ResponsePOST /minn-admin/v1/users/{id:\d+}/appearance (cap edit_user on {id})#

Saves a user's appearance.

methodhidden(Minn\Http\Request $request, string $id): Minn\Http\ResponseGET /minn-admin/v1/users/{id:\d+}/hidden (cap edit_user on {id})#

The target user's restore list, for the user edit page.

methodunhideForUser(Minn\Http\Request $request, string $id): Minn\Http\ResponsePOST /minn-admin/v1/users/{id:\d+}/integrations/unhide (cap edit_user on {id})#

An administrator restores something another person hid; hiding stays that person's own choice.

methodhide(Minn\Http\Request $request): Minn\Http\ResponsePOST /minn-admin/v1/integrations/hide (floor edit_posts)#

Hides a view for the caller.

methodunhide(Minn\Http\Request $request): Minn\Http\ResponsePOST /minn-admin/v1/integrations/unhide (floor edit_posts)#

Shows a view again for the caller.

Internals 5

Private and protected methods: how the class does its work. Not a contract; they change whenever the code is tidied.

privateleaveToPlugin(): void#

Declines the route while Minn Admin runs as code, so the plugin's own answers: it validates against every integration its adapters register and repaints with the slices they build (the engine's registry holds only the core views, and an empty answer emptied the app's nav).

privateintegrationId(Minn\Http\Request $request): string#
privateintegrationState(int $userId): array#

The boot slices a hide or unhide repaints from when Minn Admin is not running as code: no plugin surfaces, editor panels, design sources, or block forms then.

privateappearanceBody(Minn\Http\Request $request): array#
privateeditableUser(string $id): int#