FaxStore
FaxStore uses a bitfield based permission system to allow for a more granular permission set for merchants to control the store to the best ability. Permission names are straight forward in their name in terms of what permissions are granted.
The permissions of FaxStore include
Name | Description |
|---|---|
NONE | No permissions for the user. This is used for normal site users. |
VIEW_STAFF_PANEL | Allows the user to view the staff panel, this essentially unlocks the 'Staff' button in the header. |
EDIT_USER | Allows editing of user settings and edit the staff note on users. |
EMAIL_USERS | Allows staff to send individual or mass emails. |
DELETE_USERS | Allows staff to delete user accounts fully. |
BAN_USERS | Allows staff to (un)ban users. |
DISABLE_USERS | Allows staff to be able to (un)disable user accounts. |
VIEW_USERS | Allows staff to view user profiles and details, including owned items, receipts. They can't action anything on the user only view. |
VIEW_AUDIT_LOG | Allows staff to view the stores audit logs. |
VIEW_INSIGHTS | Allows staff to view the stores insights along with individual store item statistics. |
VIEW_INVOICES | Allows staff to only view invoices. |
VIEW_GIFTCARDS | Allows staff to view users gift cards. |
MANAGE_INVOICES | Allows staff to manage invoices; creating, editing, and cancelling. |
MANAGE_BLOGS | Allows staff to manage blogs; create, delete, and edit both articles and blog settings (including categories) |
MANAGE_PAGES | Allows staff to manage static pages, team members, and home page settings. |
MANAGE_GALLERY | Allows staff to upload and delete images in the gallery. |
MANAGE_PARTNERS | Allows staff to create, edit, and delete partners. |
MANAGE_ORDERS | Allows staff to view and update all orders. |
MANAGE_STORE | Allows staff to; create, edit, delete everything store related including releases. |
MANAGE_SUBSCRIPTIONS | Allows staff to manage subscriptions and view them. |
MANAGE_OWNED_ITEMS | Allows staff to add, delete and view a users owned items. |
MANAGE_GIFTCARDS | Allows staff to add and delete gift cards from users. |
OWNER | Allows every permission listed and can't be overridden by any permission. |
MANAGE_FORMS | Allows staff to create, delete, edit, and view all forms. |
MANAGE_QUOTES | Allows a user to create, update, and delete quotes. |
MANAGE_LICENSES | For integration with the FaxStore license system, this allows users to view and manage licenses. |
// hasPermission(userData, permission)
// The second parameter (permission) can be a string of a permission or an array of permissions, if one is met it returns true.
if(hasPermission(userData || userInfo || {id: userId, bitfield: userBitfield}, 'VIEW_USERS')) {
console.log(`User has permission 'VIEW_USERS'`);
// Function returns a BOOLEAN
}
// More refined example:
if(hasPermission({id: '282762192544333827', bitfield: '19669056'}, 'MANAGE_OWNED_ITEMS')) {
console.log(`User has permission 'MANAGE_OWNED_ITEMS'`);
}