constants.ts 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. import { LanguageCode } from '@vendure/common/lib/generated-types';
  2. import { CrudPermissionDefinition, PermissionDefinition } from './permission-definition';
  3. /**
  4. * This value should be rarely used - only in those contexts where we have no access to the
  5. * VendureConfig to ensure at least a valid LanguageCode is available.
  6. */
  7. export const DEFAULT_LANGUAGE_CODE = LanguageCode.en;
  8. export const TRANSACTION_MANAGER_KEY = Symbol('TRANSACTION_MANAGER');
  9. export const REQUEST_CONTEXT_KEY = 'vendureRequestContext';
  10. export const DEFAULT_PERMISSIONS: PermissionDefinition[] = [
  11. new PermissionDefinition({
  12. name: 'Authenticated',
  13. description: 'Authenticated means simply that the user is logged in',
  14. assignable: true,
  15. internal: true,
  16. }),
  17. new PermissionDefinition({
  18. name: 'SuperAdmin',
  19. description: 'SuperAdmin has unrestricted access to all operations',
  20. assignable: true,
  21. internal: true,
  22. }),
  23. new PermissionDefinition({
  24. name: 'Owner',
  25. description: `Owner means the user owns this entity, e.g. a Customer's own Order`,
  26. assignable: false,
  27. internal: true,
  28. }),
  29. new PermissionDefinition({
  30. name: 'Public',
  31. description: `Public means any unauthenticated user may perform the operation`,
  32. assignable: false,
  33. internal: true,
  34. }),
  35. new CrudPermissionDefinition('Catalog'),
  36. new CrudPermissionDefinition('Customer'),
  37. new CrudPermissionDefinition('Administrator'),
  38. new CrudPermissionDefinition('Order'),
  39. new CrudPermissionDefinition('Promotion'),
  40. new CrudPermissionDefinition('Settings'),
  41. ];