UNPKG

vue-permission-directive

Version:

A flexible Vue 3 directive for managing user permissions with support for AND, OR, regex, and pattern-based checks.

24 lines (20 loc) 1.02 kB
import { Ref, App, Directive } from 'vue'; type PermissionMode = "and" | "or" | "startWith" | "endWith" | "exact" | "regex"; interface PermissionObject { permissions: string[]; mode: PermissionMode; } type PermissionValue = string | string[] | PermissionObject | (string | PermissionObject)[]; type PermissionsArray = string[] | Ref<string[]>; declare const configurePermissionDirective: (permissions: PermissionsArray, options?: { developmentMode?: boolean; }) => void; declare const initPermissionDirectiveIfNeeded: () => void; declare const setDevelopmentMode: (enabled: boolean) => void; declare const clearPermissionCache: () => void; declare const hasPermission: (permissionValue: PermissionValue) => Promise<boolean>; declare const vPermission: Directive; declare const PermissionPlugin: { install(app: App): void; }; export { clearPermissionCache, configurePermissionDirective, PermissionPlugin as default, hasPermission, initPermissionDirectiveIfNeeded, setDevelopmentMode, vPermission };