1 -- @tag: add_master_rights
 
   2 -- @description: Rechte in die Datenbank migrieren
 
   3 -- @depends: release_3_2_0
 
   5 -- @locales: Master Data
 
   6 -- @locales: Create customers and vendors. Edit all vendors. Edit only customers where salesman equals employee (login)
 
   7 -- @locales: Create customers and vendors. Edit all vendors. Edit all customers
 
   8 -- @locales: Create and edit parts, services, assemblies
 
   9 -- @locales: Show details and reports of parts, services, assemblies
 
  10 -- @locales: Create and edit projects
 
  12 -- @locales: Create and edit requirement specs
 
  13 -- @locales: Create and edit sales quotations
 
  14 -- @locales: Create and edit sales orders
 
  15 -- @locales: Create and edit sales delivery orders
 
  16 -- @locales: Create and edit invoices and credit notes
 
  17 -- @locales: Create and edit dunnings
 
  18 -- @locales: Edit sales letters
 
  19 -- @locales: View/edit all employees sales documents
 
  20 -- @locales: Edit prices and discount (if not used, textfield is ONLY set readonly)
 
  21 -- @locales: Show AR transactions as part of AR invoice report
 
  22 -- @locales: Show delivery plan
 
  23 -- @locales: Show delivery value report
 
  24 -- @locales: Show sales letters report
 
  26 -- @locales: Create and edit RFQs
 
  27 -- @locales: Create and edit purchase orders
 
  28 -- @locales: Create and edit purchase delivery orders
 
  29 -- @locales: Create and edit vendor invoices
 
  30 -- @locales: Show AP transactions as part of AP invoice report
 
  31 -- @locales: Warehouse management
 
  32 -- @locales: View warehouse content
 
  33 -- @locales: Warehouse management
 
  34 -- @locales: General ledger and cash
 
  35 -- @locales: Transactions, AR transactions, AP transactions
 
  36 -- @locales: DATEV Export
 
  37 -- @locales: Receipt, payment, reconciliation
 
  38 -- @locales: Bank transactions
 
  40 -- @locales: All reports
 
  41 -- @locales: Advance turnover tax return
 
  42 -- @locales: Batch Printing
 
  43 -- @locales: Batch Printing
 
  44 -- @locales: Configuration
 
  45 -- @locales: Change kivitendo installation settings (most entries in the 'System' menu)
 
  46 -- @locales: Client administration: configuration, editing templates, task server control, background jobs (remaining entries in the 'System' menu)
 
  48 -- @locales: May set the BCC field when sending emails
 
  49 -- @locales: Productivity
 
  50 -- @locales: Show administration link
 
  52 CREATE TABLE auth.master_rights (
 
  53   id          SERIAL PRIMARY KEY,
 
  54   position    INTEGER NOT NULL,
 
  55   name        TEXT NOT NULL UNIQUE,
 
  56   description TEXT NOT NULL,
 
  57   category    BOOLEAN NOT NULL DEFAULT FALSE
 
  61 INSERT INTO auth.master_rights (position, name, description, category) VALUES ( 1, 'master_data',                    'Master Data', TRUE);
 
  62 INSERT INTO auth.master_rights (position, name, description) VALUES ( 2, 'customer_vendor_edit',           'Create customers and vendors. Edit all vendors. Edit only customers where salesman equals employee (login)');
 
  63 INSERT INTO auth.master_rights (position, name, description) VALUES ( 3, 'customer_vendor_all_edit',       'Create customers and vendors. Edit all vendors. Edit all customers');
 
  64 INSERT INTO auth.master_rights (position, name, description) VALUES ( 4, 'part_service_assembly_edit',     'Create and edit parts, services, assemblies');
 
  65 INSERT INTO auth.master_rights (position, name, description) VALUES ( 5, 'part_service_assembly_details',  'Show details and reports of parts, services, assemblies');
 
  66 INSERT INTO auth.master_rights (position, name, description) VALUES ( 6, 'project_edit',                   'Create and edit projects');
 
  67 INSERT INTO auth.master_rights (position, name, description, category) VALUES ( 7, 'ar',                             'AR', TRUE);
 
  68 INSERT INTO auth.master_rights (position, name, description) VALUES ( 8, 'requirement_spec_edit',          'Create and edit requirement specs');
 
  69 INSERT INTO auth.master_rights (position, name, description) VALUES ( 9, 'sales_quotation_edit',           'Create and edit sales quotations');
 
  70 INSERT INTO auth.master_rights (position, name, description) VALUES (10, 'sales_order_edit',               'Create and edit sales orders');
 
  71 INSERT INTO auth.master_rights (position, name, description) VALUES (11, 'sales_delivery_order_edit',      'Create and edit sales delivery orders');
 
  72 INSERT INTO auth.master_rights (position, name, description) VALUES (12, 'invoice_edit',                   'Create and edit invoices and credit notes');
 
  73 INSERT INTO auth.master_rights (position, name, description) VALUES (13, 'dunning_edit',                   'Create and edit dunnings');
 
  74 INSERT INTO auth.master_rights (position, name, description) VALUES (14, 'sales_letter_edit',              'Edit sales letters');
 
  75 INSERT INTO auth.master_rights (position, name, description) VALUES (15, 'sales_all_edit',                 'View/edit all employees sales documents');
 
  76 INSERT INTO auth.master_rights (position, name, description) VALUES (16, 'edit_prices',                    'Edit prices and discount (if not used, textfield is ONLY set readonly)');
 
  77 INSERT INTO auth.master_rights (position, name, description) VALUES (17, 'show_ar_transactions',           'Show AR transactions as part of AR invoice report');
 
  78 INSERT INTO auth.master_rights (position, name, description) VALUES (18, 'delivery_plan',                  'Show delivery plan');
 
  79 INSERT INTO auth.master_rights (position, name, description) VALUES (19, 'delivery_value_report',          'Show delivery value report');
 
  80 INSERT INTO auth.master_rights (position, name, description) VALUES (20, 'sales_letter_report',            'Show sales letters report');
 
  81 INSERT INTO auth.master_rights (position, name, description, category) VALUES (21, 'ap',                             'AP', TRUE);
 
  82 INSERT INTO auth.master_rights (position, name, description) VALUES (22, 'request_quotation_edit',         'Create and edit RFQs');
 
  83 INSERT INTO auth.master_rights (position, name, description) VALUES (23, 'purchase_order_edit',            'Create and edit purchase orders');
 
  84 INSERT INTO auth.master_rights (position, name, description) VALUES (24, 'purchase_delivery_order_edit',   'Create and edit purchase delivery orders');
 
  85 INSERT INTO auth.master_rights (position, name, description) VALUES (25, 'vendor_invoice_edit',            'Create and edit vendor invoices');
 
  86 INSERT INTO auth.master_rights (position, name, description) VALUES (26, 'show_ap_transactions',           'Show AP transactions as part of AP invoice report');
 
  87 INSERT INTO auth.master_rights (position, name, description, category) VALUES (27, 'warehouse',                      'Warehouse management', TRUE);
 
  88 INSERT INTO auth.master_rights (position, name, description) VALUES (28, 'warehouse_contents',             'View warehouse content');
 
  89 INSERT INTO auth.master_rights (position, name, description) VALUES (29, 'warehouse_management',           'Warehouse management');
 
  90 INSERT INTO auth.master_rights (position, name, description, category) VALUES (30, 'general_ledger_cash',            'General ledger and cash', TRUE);
 
  91 INSERT INTO auth.master_rights (position, name, description) VALUES (31, 'general_ledger',                 'Transactions, AR transactions, AP transactions');
 
  92 INSERT INTO auth.master_rights (position, name, description) VALUES (32, 'datev_export',                   'DATEV Export');
 
  93 INSERT INTO auth.master_rights (position, name, description) VALUES (33, 'cash',                           'Receipt, payment, reconciliation');
 
  94 INSERT INTO auth.master_rights (position, name, description) VALUES (34, 'bank_transaction',               'Bank transactions');
 
  95 INSERT INTO auth.master_rights (position, name, description, category) VALUES (35, 'reports',                        'Reports', TRUE);
 
  96 INSERT INTO auth.master_rights (position, name, description) VALUES (36, 'report',                         'All reports');
 
  97 INSERT INTO auth.master_rights (position, name, description) VALUES (37, 'advance_turnover_tax_return',    'Advance turnover tax return');
 
  98 INSERT INTO auth.master_rights (position, name, description, category) VALUES (38, 'batch_printing_category',                 'Batch Printing', TRUE);
 
  99 INSERT INTO auth.master_rights (position, name, description) VALUES (39, 'batch_printing',                 'Batch Printing');
 
 100 INSERT INTO auth.master_rights (position, name, description, category) VALUES (40, 'configuration',                  'Configuration', TRUE);
 
 101 INSERT INTO auth.master_rights (position, name, description) VALUES (41, 'config',                         'Change kivitendo installation settings (most entries in the ''System'' menu)');
 
 102 INSERT INTO auth.master_rights (position, name, description) VALUES (42, 'admin',                          'Client administration: configuration, editing templates, task server control, background jobs (remaining entries in the ''System'' menu)');
 
 103 INSERT INTO auth.master_rights (position, name, description, category) VALUES (43, 'others',                         'Others', TRUE);
 
 104 INSERT INTO auth.master_rights (position, name, description) VALUES (44, 'email_bcc',                      'May set the BCC field when sending emails');
 
 105 INSERT INTO auth.master_rights (position, name, description) VALUES (45, 'productivity',                   'Productivity');
 
 106 INSERT INTO auth.master_rights (position, name, description) VALUES (46, 'display_admin_link',             'Show administration link');