useTicketCreate.ts 808 B

12345678910111213141516171819202122232425262728293031
  1. // Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/
  2. import { computed } from 'vue'
  3. import { useApplicationStore } from '#shared/stores/application.ts'
  4. import { useSessionStore } from '#shared/stores/session.ts'
  5. export const useTicketCreate = () => {
  6. const application = useApplicationStore()
  7. const session = useSessionStore()
  8. const ticketCreateEnabled = computed(() => {
  9. return (
  10. session.hasPermission('ticket.agent') ||
  11. (session.hasPermission('ticket.customer') &&
  12. application.config.customer_ticket_create)
  13. )
  14. })
  15. const isTicketCustomer = computed(() => {
  16. return (
  17. session.hasPermission('ticket.customer') &&
  18. !session.hasPermission('ticket.agent')
  19. )
  20. })
  21. return {
  22. ticketCreateEnabled,
  23. isTicketCustomer,
  24. }
  25. }