types.d.ts 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  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. 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. }
  50. interface AccessStore extends Store<{profile:{access:accessState}}> {}
  51. interface organizationState {
  52. name: string,
  53. product?: string,
  54. modules?: Array<string>,
  55. hasChildren?: boolean,
  56. website?: string,
  57. subDomain?: string,
  58. parents: Array<organizationState>,
  59. }
  60. interface OrganizationStore extends Store<{profile:{organization:organizationState}}> {}
  61. interface AnyJson extends Record<string, any> {}
  62. interface AnyStore extends Store<any> {}