mirror of
https://github.com/affaan-m/everything-claude-code.git
synced 2026-06-10 10:13:49 +08:00
Translated 85 skill sub-reference files to achieve full parity with the English source: - skills/angular-developer/references/ — 35 files (all references) - skills/remotion-video-creation/rules/ — 28 files (all rules) - skills/tinystruct-patterns/references/ — 5 files - skills/openclaw-persona-forge/references/ — 6 files - skills/skill-comply/prompts/ — 3 files - skills/lead-intelligence/agents/ — 4 files - skills/brand-voice/references/ — 1 file - skills/frontend-slides/ — 2 files - hooks/memory-persistence/README.md — 1 file English source parity: 0 missing files (excluding rules/zh/, internal docs, and experimental examples absent from zh-CN)
1.8 KiB
1.8 KiB
ルートガード
ルートガードは、ユーザーがルートへ遷移できるか、またはルートから離れられるかを制御します。
ガードの種類
CanActivate:ユーザーはこのルートにアクセスできるか?(例:認証チェック)CanActivateChild:ユーザーはこのルートの子にアクセスできるか?CanDeactivate:ユーザーはこのルートから離れられるか?(例:未保存の変更)CanMatch:このルートはマッチングの対象として考慮すべきか?(例:フィーチャーフラグ)falseを返すと、ルーターは他のルートのチェックを継続します。
ガードの作成
Angular 15 以降、ガードは通常、関数として定義します。
export const authGuard: CanActivateFn = (route, state) => {
const authService = inject(AuthService);
const router = inject(Router);
if (authService.isLoggedIn()) {
return true;
}
// ログインページへリダイレクト
return router.parseUrl('/login');
};
ガードの適用
ルート設定に配列として追加します。順番通りに実行されます。
{
path: 'admin',
component: Admin,
canActivate: [authGuard],
canActivateChild: [adminChildGuard],
canDeactivate: [unsavedChangesGuard]
}
戻り値
boolean:trueで許可、falseでブロック。UrlTreeまたはRedirectCommand:別のルートへリダイレクト。ObservableまたはPromise:上記の型に解決されます。
セキュリティに関する注意
クライアントサイドのガードはサーバーサイドのセキュリティの代わりにはなりません。 サーバー側で常に権限を検証してください。