Skip to main content Link Menu Expand (external link) Document Search Copy Copied

Wisk Roles and Permissions

Wisk has the concept of roles and permissions.

  • A role is a set of permissions.
  • A user can have one or more roles.
  • A permission is a right to do something

We have a few roles predefined in the system:

  • they are found in the table wisk_roles and are inherited by all venues

The venues can also define their own roles:

  • they are found in the table roles and are specific to the venue

The permissions are kept in the swift code:

  • they are found in the file Permission.swift img_4.png

How to add a new permission

  • add the permission to the Permission.swift file
  • assign the permission to the proper Wisk predefined role both in code and in the wisk_roles table (using a db migration)
  • right now, we also need to run something on Postman to synchronize all roles for venues in realtime sync database:
 POST /resync-data
 
 Payload: 
 {
    "venue": {
        "type": "all"
    },
    "dataset": {
        "type": "document_types",
        "value": ["role"]
    },
    "cleanup_first": true,
    "increase_version": false
}

Naming convention for permissions

  • The permission should start with the name of the entity it is related to and then contain the action
    • ex: item_create, inventory_start, inventory_approve

Below is the suggested rename for the permissions:

  • group

    • id: xx type: .swift
      • suggested new name
  • actions

    • add - can add things
    • remove - can remove things
    • manage - can do anything (view, add, remove, archive, etc.)
    • view - can view but don’t manage
    • archive - can archive things
  • inventory
    • id: 1, type: .independentInventories)
      • “independent_inventory_view”
    • id: 2, type: .editInventory)
      • “inventory_manage”
    • id: 3, type: .archiveInventory)
      • “inventory_archive”
    • id: 4, type: .submitInventory)
      • “inventory_submit”
    • id: 24, type: .inventoryStart)
      • “inventory_start”
    • id: 28, type: .viewInventoriesPage)
      • “inventory_view”
  • order
    • Permission(id: 30, type: .viewDeliveriesPage),
      • “invoice_view”
    • Permission(id: 5, type: .sendPurchaseOrderEmail)
      • “purchase_order_email”
    • Permission(id: 6, type: .receiveFromPurchaseOrder),
      • “purchase_order_receive_from”
    • Permission(id: 7, type: .editDelivery),
      • “invoice_manage”
    • Permission(id: 8, type: .createManualIntake),
      • “invoice_add”
    • Permission(id: 9, type: .archiveDelivery),
      • “invoice_archive”
    • Permission(id: 10, type: .generatePurchaseOrder),
      • “purchase_order_generate”
    • Permission(id: 11, type: .setIdealStockDays),
      • “ideal_stock_days_manage”
    • Permission(id: 29, type: .viewOrdersPage),
      • “purchase_order_view”
    • Permission(id: 39, type: .approveScannedInvoice),
      • “draft_invoice_approve”
    • Permission(id: 40, type: .archiveScannedInvoice),
      • “draft_invoice_archive”
    • Permission(id: 45, type: .createEditPurchaseOrderSchedules),
      • “purchase_order_schedule_manage”
    • Permission(id: 46, type: .addNeedsReviewToScannedInvoiceItem),
      • “invoice_needs_review_add”
    • Permission(id: 47, type: .removeNeedsReviewToScannedInvoiceItem),
      • “invoice_needs_review_remove”
    • Permission(id: 51, type: .purchaseOrderApprove),
      • “purchase_order_approve”
  • venueBottles - items
    • Permission(id: 12, type: .viewVenueBottles),
      • “item_view”
    • Permission(id: 13, type: .editVenueBottles),
      • “item_manage”
    • Permission(id: 14, type: .archiveVenueBottles),
      • “item_archive”
    • Permission(id: 15, type: .manageFamiliesAndCategories),
      • “family_category_view”
    • Permission(id: 16, type: .setParLevels),
      • “item_par_level_manage”
  • consumption
    • Permission(id: 17, type: .viewConsumption),
      • “consumption_view”
  • bottleLogs - itemLogs
    • Permission(id: 18, type: .addReturnsWastagePromo),
      • “item_returns_wastage_promo_add”
  • sales
    • Permission(id: 19, type: .viewSalesData),
      • “sale_view”
  • variance
    • Permission(id: 20, type: .viewVariance),
      • “variance_view”
  • account
    • Permission(id: 21, type: .createEditDeleteLocations),
      • “area_manage”
    • Permission(id: 22, type: .inviteUsers),
      • “user_add”
    • Permission(id: 23, type: .viewVenueSettings),
      • “venue_settings_manage”
    • Permission(id: 25, type: .changeUserRole),
      • “user_role_manage”
    • Permission(id: 34, type: .removeUserFromVenue),
      • “user_remove”
    • Permission(id: 31, type: .viewDashboardPage),
      • “dashboard_view”
    • Permission(id: 36, type: .changeNotificationSettings),
      • “notification_settings_manage”
  • venues
    • Permission(id: 26, type: .createVenue),
      • “venue_add”
    • Permission(id: 27, type: .viewVenuesPage),
      • “venue_view”
    • Permission(id: 52, type: .roleEdit),
      • “role_manage”
  • posItems
    • Permission(id: 32, type: .viewPosItems),
      • “pos_item_view”
    • Permission(id: 35, type: .viewSubRecipes),
      • “batch_view”
    • Permission(id: 37, type: .editPosItems),
      • “pos_item_manage”
    • Permission(id: 38, type: .editSubRecipes),
      • “batch_manage”
  • billing
    • Permission(id: 33, type: .billing),
      • “billing_manage”
  • accounting
    • Permission(id: 41, type: .sendInvoicesToAccounting),
      • “invoice_send_to_accounting”
    • Permission(id: 42, type: .createEditGlAccounts),
      • “gl_account_manage”
    • Permission(id: 43, type: .assignGlAccounts),
      • “gl_account_assign”
    • Permission(id: 49, type: .taxRateSet),
      • “tax_rate_manage”
    • Permission(id: 50, type: .taxRateAssign),
      • “tax_rate_assign”
  • multiVenue

    • Permission(id: 44, type: .createEditTransferRequests),
      • “transfer_request_manage”
    • Permission(id: 48, type: .manageSharedItems)
      • “shared_item_manage”
ID Title Key Key Group
24 Start inventories inventory_start inventory_start Inventory
1 Independent inventories independent_inventory_view independent_inventories Inventory
2 Edit completed inventories inventory_manage edit_inventory Inventory
3 Archive inventories inventory_archive archive_inventory Inventory
4 Approve inventories inventory_submit submit_inventory Inventory
28 View inventories page inventory_view view_inventories_page Inventory
5 Send purchase order emails purchase_order_email send_purchase_order_email Order
6 Receive from purchase orders purchase_order_receive_from receive_from_purchase_order Order
8 Create manual invoices invoice_add create_manual_intake Order
9 Archive invoices invoice_archive archive_delivery Order
10 Generate purchase orders purchase_order_generate generate_purchase_order Order
11 Set ideal stock days ideal_stock_days_manage set_ideal_stock_days Order
29 View orders page purchase_order_view view_orders_page Order
46 Flag draft invoice item as needs review invoice_needs_review_add add_needs_review_to_scanned_invoice_item Order
47 Confirm draft invoice item after review invoice_needs_review_remove remove_needs_review_to_scanned_invoice_item Order
51 Approve purchase orders purchase_order_approve purchase_order_approve Order
12 View items item_view view_venue_bottles Items
13 Edit item item_manage edit_venue_bottles Items
14 Archive items item_archive archive_venue_bottles Items
15 Manage families and categories family_category_view manage_families_and_categories Items
16 Set par levels item_par_level_manage set_par_levels Items
17 View consumptions consumption_view view_consumption Consumption
18 Add returns, wastage and promo item_returns_wastage_promo_add add_returns_wastage_promo Depletions
19 View sales data sale_view view_sales_data Sales
20 View variance variance_view view_variance Variance
21 Manage areas area_manage create_edit_delete_locations Account
22 Invite users user_add invite_users Account
23 View venue settings venue_settings_manage view_venue_settings Account
25 Change user role user_role_manage change_user_role Account
34 Remove user from venue user_remove remove_user_from_venue Account
31 View dashboard page dashboard_view view_dashboard_page Account
36 Change notification settings notification_settings_manage change_notification_settings Account
26 Create venue venue_add create_venue Venues
27 View venues page venue_view view_venues_page Venues
52 Role edit role_manage role_edit Venues
30 View invoices page invoice_view view_deliveries_page Invoices
7 Edit invoices invoice_manage edit_delivery Invoices
39 Approve draft invoice draft_invoice_approve approve_scanned_invoice Invoices
40 Archive draft invoice draft_invoice_archive archive_scanned_invoice Invoices
32 View POS items pos_item_view view_pos_items POS items
35 View sub recipes batch_view view_sub_recipes POS items
37 Edit POS items pos_item_manage edit_pos_items POS items
38 Edit sub recipes batch_manage edit_sub_recipes POS items
33 Billing billing_manage billing Billing
42 Manage GL accounts gl_account_manage create_edit_gl_accounts Accounting
43 Assign GL accounts gl_account_assign assign_gl_accounts Accounting
41 Send invoices to accounting invoice_send_to_accounting send_invoices_to_accounting Accounting
49 Manage tax rates tax_rate_manage tax_rate_set Accounting
50 Assign tax rates tax_rate_assign tax_rate_assign Accounting
44 Manage transfer requests transfer_request_manage create_edit_transfer_requests Multivenue
48 Manage shared items shared_item_manage manage_shared_items Multivenue