123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318 |
- window.onload = function() {
- App.Role.refresh([
- {
- name: "Agent",
- permission_ids: [
- 48,
- ],
- group_ids: {},
- default_at_signup: false,
- note: "To work on Tickets.",
- active: true,
- updated_at: "2020-07-29T14:57:27.304Z",
- id: 2
- },
- {
- name: "Customer",
- permission_ids: [
- 49
- ],
- group_ids: {},
- default_at_signup: true,
- note: "People who create Tickets ask for help.",
- active: true,
- updated_at: "2020-07-29T14:57:27.314Z",
- id: 3
- }
- ])
- App.Permission.refresh([
- {
- name: "ticket.agent",
- note: "Access to Agent Tickets based on Group Access",
- active: true,
- id: 48
- },
- {
- name: "ticket.customer",
- note: "Access to Customer Tickets based on current_user and organization",
- active: true,
- id: 49
- },
- ])
- App.User.refresh([
- {
- login: "nicole.braun@zammad.org",
- firstname: "Nicole",
- lastname: "Braun",
- email: "nicole.braun@zammad.org",
- web: "",
- phone: "",
- fax: "",
- mobile: "",
- street: "",
- zip: "",
- city: "",
- country: "",
- organization_id: 1,
- department: "",
- note: "",
- role_ids: [
- 3
- ],
- group_ids: {},
- active: true,
- updated_at: "2023-08-23T08:59:15.437Z",
- organization_ids: [],
- address: "",
- vip: false,
- id: 2
- },
- {
- login: "admin@example.com",
- firstname: "Test Admin",
- lastname: "Agent",
- email: "admin@example.com",
- web: "",
- phone: "",
- fax: "",
- mobile: "",
- street: "",
- zip: "",
- city: "",
- country: "",
- organization_id: null,
- department: null,
- note: "",
- role_ids: [
- 2
- ],
- group_ids: {
- 1: [
- "full"
- ],
- 2: [
- "full"
- ]
- },
- active: true,
- updated_at: "2023-08-23T08:51:07.062Z",
- organization_ids: [],
- address: null,
- vip: false,
- id: 3
- }
- ])
- App.Group.refresh([
- {
- name: "Users",
- assignment_timeout: null,
- follow_up_possible: "yes",
- follow_up_assignment: true,
- email_address_id: 1,
- signature_id: 1,
- note: "Standard Group/Pool for Tickets.",
- active: true,
- shared_drafts: true,
- updated_at: "2023-08-23T08:31:24.665Z",
- reopen_time_in_days: null,
- id: 1
- }
- ])
- App.EmailAddress.refresh([
- {
- name: "Zammad Helpdesk",
- email: "zammad@localhost",
- channel_id: 1,
- note: null,
- active: true,
- updated_at: "2023-08-23T08:31:24.483Z",
- id: 1
- }
- ])
- App.Ticket.refresh([{
- id: 1,
- title: 'ticket1',
- state_id: 1,
- customer_id: 33,
- organization_id: 1,
- owner_id: 1,
- group_id: 1,
- },
- {
- id: 2,
- title: 'ticket2',
- state_id: 1,
- customer_id: 44,
- organization_id: 1,
- owner_id: 1,
- },
- {
- id: 3,
- title: 'ticket3',
- state_id: 1,
- customer_id: 55,
- organization_id: undefined,
- owner_id: 1,
- },
- {
- id: 4,
- title: 'ticket4',
- state_id: 1,
- customer_id: 66,
- organization_id: undefined,
- owner_id: 1,
- group_id: 1,
- },
- {
- id: 5,
- title: 'ticket5',
- state_id: 1,
- customer_id: 66,
- organization_id: 123,
- owner_id: 1,
- group_id: 1,
- }])
- App.User.refresh([{
- id: 33,
- login: 'hh@1example.com',
- firstname: 'Harald',
- lastname: 'Habebe',
- email: 'hh1@example.com',
- organization_id: 1,
- role_ids: [3],
- active: true,
- },
- {
- id: 44,
- login: 'hh2@example.com',
- firstname: 'Harald',
- lastname: 'Habebe',
- email: 'hh2@example.com',
- organization_id: 2,
- role_ids: [3],
- active: true,
- },
- {
- id: 55,
- login: 'hh3example.com',
- firstname: 'Harald',
- lastname: 'Habebe',
- email: 'hh3@example.com',
- organization_id: undefined,
- organization_ids: [123], // secondary organization
- role_ids: [3],
- active: true,
- }])
- App.TicketArticle.refresh([
- {
- from: "Nicole Braun <nicole.braun@zammad.org>",
- to: null,
- cc: null,
- subject: null,
- body: "from customer article",
- content_type: "text/plain",
- ticket_id: 1,
- type_id: 5,
- sender_id: 2,
- internal: false,
- in_reply_to: null,
- preferences: {},
- updated_at: "2023-08-23T08:31:12.483Z",
- id: 1,
- created_by_id: 2,
- },
- {
- from: "Test Admin Agent via Zammad Helpdesk <zammad@localhost>",
- to: "nicole.braun@zammad.org",
- cc: "",
- subject: "Welcome to Zammad!",
- body: "from agent article",
- content_type: "text/html",
- ticket_id: 1,
- type_id: 1,
- sender_id: 1,
- internal: false,
- in_reply_to: "",
- preferences: {},
- updated_at: "2023-08-23T08:59:21.632Z",
- id: 2,
- created_by_id: 3,
- },
- ])
- QUnit.test('ticket.editabe customer user #1', assert => {
- App.Session.set(33)
- ticket1 = App.Ticket.find(1);
- assert.ok(ticket1.editable(), 'access via customer_id');
- ticket2 = App.Ticket.find(2);
- assert.ok(ticket2.editable(), 'access via organization_id');
- ticket3 = App.Ticket.find(3);
- assert.ok(!ticket3.editable(), 'no access');
- ticket4 = App.Ticket.find(4);
- assert.ok(!ticket4.editable(), 'no access');
- ticket5 = App.Ticket.find(5);
- assert.ok(!ticket5.editable(), 'no access');
- });
- QUnit.test('ticket.editabe customer user #2', assert => {
- App.Session.set(44)
- ticket1 = App.Ticket.find(1);
- assert.ok(!ticket1.editable(), 'no access');
- ticket2 = App.Ticket.find(2);
- assert.ok(ticket2.editable(), 'access via customer_id');
- ticket3 = App.Ticket.find(3);
- assert.ok(!ticket3.editable(), 'no access');
- ticket4 = App.Ticket.find(4);
- assert.ok(!ticket4.editable(), 'no access');
- ticket5 = App.Ticket.find(5);
- assert.ok(!ticket5.editable(), 'no access');
- });
- QUnit.test('ticket.editabe customer user #3', assert => {
- App.Session.set(55)
- ticket1 = App.Ticket.find(1);
- assert.ok(!ticket1.editable(), 'no access');
- ticket2 = App.Ticket.find(2);
- assert.ok(!ticket2.editable(), 'no access');
- ticket3 = App.Ticket.find(3);
- assert.ok(ticket3.editable(), 'access via customer_id');
- ticket4 = App.Ticket.find(4);
- assert.ok(!ticket4.editable(), 'no access');
- ticket5 = App.Ticket.find(5);
- assert.ok(ticket5.editable(), 'access via secondary organization');
- });
- QUnit.test('Agent name is unintentionally exposed when reply with quote of own agent article #4768', assert => {
- App.Config.set('ticket_define_email_from', 'AgentNameSystemAddressName')
- App.Config.set('ticket_define_email_from_separator', 'via')
- article1 = App.TicketArticle.find(1);
- console.log('article1', article1)
- assert.equal(article1.recipientName(), 'Nicole Braun');
- article2 = App.TicketArticle.find(2);
- assert.equal(article2.recipientName(), 'Test Admin Agent via Zammad Helpdesk');
- App.Config.set('ticket_define_email_from', 'SystemAddressName')
- App.Config.set('ticket_define_email_from_separator', 'via')
- article1 = App.TicketArticle.find(1);
- assert.equal(article1.recipientName(), 'Nicole Braun');
- article2 = App.TicketArticle.find(2);
- assert.equal(article2.recipientName(), 'Zammad Helpdesk');
- App.Config.set('ticket_define_email_from', 'AgentName')
- App.Config.set('ticket_define_email_from_separator', 'via')
- article1 = App.TicketArticle.find(1);
- assert.equal(article1.recipientName(), 'Nicole Braun');
- article2 = App.TicketArticle.find(2);
- assert.equal(article2.recipientName(), 'Test Admin Agent');
- });
- }
|