types.d.ts 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. import {Store} from "vuex";
  2. import {Ability} from "@casl/ability";
  3. interface ItemsMenu extends Array<ItemMenu> {}
  4. /**
  5. * Upgrade du @nuxt/types pour TypeScript
  6. */
  7. declare module '@nuxt/types' {
  8. interface Context {
  9. $ability(): Ability,
  10. $rest: AnyJson
  11. }
  12. }
  13. interface ItemMenu {
  14. icon: string,
  15. title: string,
  16. to?: string,
  17. old?: boolean,
  18. children?: ItemsMenu
  19. }
  20. interface AbilitiesType {
  21. action: 'display' | 'read' | 'manage',
  22. subject: string,
  23. /** an array of fields to which user has (or not) access */
  24. fields?: string[]
  25. /** an object of conditions which restricts the rule scope */
  26. conditions?: any
  27. /** indicates whether rule allows or forbids something */
  28. inverted?: boolean
  29. /** message which explains why rule is forbidden */
  30. reason?: string
  31. }
  32. interface accessState {
  33. bearer: string,
  34. accessId: number,
  35. roles: Array<string>,
  36. abilities: Array<AbilitiesType>,
  37. isAdmin: boolean,
  38. isAdministratifManager: boolean,
  39. isPedagogicManager: boolean,
  40. isFinancialManager: boolean,
  41. isCaMember: boolean,
  42. isStudent: boolean,
  43. isTeacher: boolean,
  44. isMember: boolean,
  45. isOther: boolean
  46. }
  47. interface AccessStore extends Store<{profile:{access:accessState}}> {}
  48. interface organizationState {
  49. name: string,
  50. product: string,
  51. modules: Array<string>,
  52. hasChildren: boolean,
  53. }
  54. interface OrganizationStore extends Store<{profile:{organization:organizationState}}> {}
  55. interface AnyJson extends Record<string, any> {}
  56. interface AnyStore extends Store<any> {}