Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message
kinetix-impersonation
kinetix-impersonation
happones/kinetix
claude-code
impersonation
kinetix
authorization
middleware
audit-logging
vue
session

Admin 'log in as user' with an escalation guard, sensitive-route protection and an audit trail. Activates when adding ImpersonateAction, starting/leaving impersonation via KinetixImpersonation, rendering the banner, or protecting routes while impersonating.

Install
php artisan boost:add-skill happones/kinetix

Save this content to: .claude/skills/kinetix-impersonation/SKILL.md

# Kinetix Impersonation Development

## When to Apply

Activate this skill when:
- Adding `ImpersonateAction` to a users table, or starting/leaving via the
  `KinetixImpersonation` facade / `useKinetixImpersonation`.
- Rendering `<KinetixImpersonationBanner>`.
- Guarding the escalation rule (`can_impersonate`) or sealing sensitive routes
  while impersonating (`kinetix.impersonation.protect`).

## Documentation

For full details, reference `docs/impersonation.md` (published at https://happones.github.io/kinetix/impersonation).

## Configuration

```php
'impersonation' => [
    'enabled'       => env('KINETIX_IMPERSONATION_ENABLED', false),
    'redirect_to'   => env('KINETIX_IMPERSONATION_REDIRECT', '/'),
    'redirect_back' => env('KINETIX_IMPERSONATION_REDIRECT_BACK', '/'),
    'can_impersonate' => null, // fn (Authenticatable $impersonator, Authenticatable $target): bool
],
```

No migration — state lives in the session.

---

## Backend Usage

```php
use Happones\Kinetix\Actions\ImpersonateAction;
use Happones\Kinetix\Impersonation\KinetixImpersonation;

// Users table
Table::make(User::query())->recordActions([ImpersonateAction::make()]);

// Programmatic
KinetixImpersonation::start($user);   // gated by users.impersonate + escalation guard
KinetixImpersonation::isImpersonating();
KinetixImpersonation::stop();
```

- **Authorization**: the `users.impersonate` ability (auto-registers with the
  permission matrix). Grant only to admins.
- **Escalation guard**: cannot impersonate a super-admin unless you are one;
  override with the `can_impersonate` closure for finer rules.
- **Protect sensitive routes** with the `kinetix.impersonation.protect` middleware
  (password/email/2FA/billing/account-deletion) — it 403s while impersonating.
  `kinetix.impersonation.protect:writes` blocks only changes (non-GET/HEAD/OPTIONS),
  so a whole group like billing stays viewable.
- **Audited**: start/stop log through the Activity event spine
  (`impersonate.start`/`impersonate.stop`, causer = the admin) when Activity is on.
- Endpoints (team-aware): `POST {prefix}/impersonate/{user}` (start),
  `DELETE {prefix}/impersonate` (leave). Target resolved by id via the auth
  provider — no User model reference needed.

---

## Frontend Usage

```vue
<!-- once in the authenticated layout -->
<KinetixImpersonationBanner />
```

Renders nothing unless active; otherwise shows "You are impersonating …" + a
return button. Reads the `kinetix_impersonation` shared prop. Build a custom UI
with `useKinetixImpersonation()` → `active`, `impersonatedName`, `leave()`.

Kinetix Impersonation Development

When to Apply

Activate this skill when:

  • Adding ImpersonateAction to a users table, or starting/leaving via the KinetixImpersonation facade / useKinetixImpersonation.
  • Rendering <KinetixImpersonationBanner>.
  • Guarding the escalation rule (can_impersonate) or sealing sensitive routes while impersonating (kinetix.impersonation.protect).

Documentation

For full details, reference docs/impersonation.md (published at https://happones.github.io/kinetix/impersonation).

Configuration

'impersonation' => [
    'enabled'       => env('KINETIX_IMPERSONATION_ENABLED', false),
    'redirect_to'   => env('KINETIX_IMPERSONATION_REDIRECT', '/'),
    'redirect_back' => env('KINETIX_IMPERSONATION_REDIRECT_BACK', '/'),
    'can_impersonate' => null, // fn (Authenticatable $impersonator, Authenticatable $target): bool
],

No migration — state lives in the session.


Backend Usage

use Happones\Kinetix\Actions\ImpersonateAction;
use Happones\Kinetix\Impersonation\KinetixImpersonation;

// Users table
Table::make(User::query())->recordActions([ImpersonateAction::make()]);

// Programmatic
KinetixImpersonation::start($user);   // gated by users.impersonate + escalation guard
KinetixImpersonation::isImpersonating();
KinetixImpersonation::stop();
  • Authorization: the users.impersonate ability (auto-registers with the permission matrix). Grant only to admins.
  • Escalation guard: cannot impersonate a super-admin unless you are one; override with the can_impersonate closure for finer rules.
  • Protect sensitive routes with the kinetix.impersonation.protect middleware (password/email/2FA/billing/account-deletion) — it 403s while impersonating. kinetix.impersonation.protect:writes blocks only changes (non-GET/HEAD/OPTIONS), so a whole group like billing stays viewable.
  • Audited: start/stop log through the Activity event spine (impersonate.start/impersonate.stop, causer = the admin) when Activity is on.
  • Endpoints (team-aware): POST {prefix}/impersonate/{user} (start), DELETE {prefix}/impersonate (leave). Target resolved by id via the auth provider — no User model reference needed.

Frontend Usage

<!-- once in the authenticated layout -->
<KinetixImpersonationBanner />

Renders nothing unless active; otherwise shows "You are impersonating …" + a return button. Reads the kinetix_impersonation shared prop. Build a custom UI with useKinetixImpersonation() → active, impersonatedName, leave().

Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
middlewares/firewall
qubiqx/montapacking
nyoncode/laravel-package-console
pnscripts/filament-broadquill-lite
pnscripts/laravel-sentfold-lite
vleap/mx-sdk-laravel-internal
twidpay/utils
htetmyathlaing/scout-elasticsearch-driver
artisan-toolbox/front-awesome
ls/client-assistant
users-au/laravel-client
robertmarney/lara-hierarchial-collections
simonschaufi/rule-doc-generator
emissaoja/emissaoja
blackbricksoftware/gravityforms-civicrm-form-processor
al-rahabi/fancy-crud
jinas/dhivatar-component
mltstephane/laravel-quality
bernskiold/laravel-talentlms
bernskioldmedia/laravel-form-architect