types.d.ts 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  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. title: string,
  15. icon?: string,
  16. to?: string,
  17. children?: ItemsMenu,
  18. isExternalLink?: boolean,
  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. name: string,
  36. givenName: string,
  37. roles: Array<string>,
  38. abilities: Array<AbilitiesType>,
  39. isAdminAccess: boolean,
  40. isAdmin: boolean,
  41. isAdministratifManager: boolean,
  42. isPedagogicManager: boolean,
  43. isFinancialManager: boolean,
  44. isCaMember: boolean,
  45. isStudent: boolean,
  46. isTeacher: boolean,
  47. isMember: boolean,
  48. isOther: boolean,
  49. hasLateralMenu: boolean,
  50. hasConfigurationMenu: boolean,
  51. hasAccessesMenu: boolean,
  52. hasFamilyMenu: boolean
  53. }
  54. interface AccessStore extends Store<{profile:{access:accessState}}> {}
  55. interface organizationState {
  56. id: number,
  57. name: string,
  58. product?: string,
  59. modules?: Array<string>,
  60. hasChildren?: boolean,
  61. networks: Array<string>,
  62. website?: string,
  63. subDomain?: string,
  64. parents: Array<organizationState>,
  65. }
  66. interface OrganizationStore extends Store<{profile:{organization:organizationState}}> {}
  67. interface AnyJson extends Record<string, any> {}
  68. interface AnyStore extends Store<any> {}