Group/Methods

Group/Methods

Source:

Methods for creating and managing admin user permission groups. Run these methods using Meteor.call().

Example

Meteor.call("group/createGroup", sampleCustomerGroup, shop._id)

Methods

(static) group/addUser(userId, groupId) → {Object}

Adds a user to a permission group Updates the user's list of permissions/roles with the defined the list defined for the group (NB: At this time, a user only belongs to only one group per shop)

Source:
Parameters:
Name Type Description
userId String

The account ID to add to the group

groupId String

ID of the group

Returns:
  • The modified group object
Type
Object

(static) group/createGroup(groupData, shopId) → {Object}

Creates a new permission group for a shop It creates permission group for a given shop with passed in roles

Source:
Parameters:
Name Type Description
groupData Object

info about group to create

Properties
Name Type Description
name String

name of the group to be created

description String

Optional description of the group to be created

permissions Array

permissions to assign to the group being created

shopId String

id of the shop the group belongs to

Returns:
  • object.status of 200 on success or Error object on failure
Type
Object

(static) group/removeUser(userId, groupId) → {Object}

Removes a user from a group for a shop, and adds them to the default customer group. Updates the user's permission list to reflect. (NB: At this time, a user only belongs to only one group per shop)

Source:
Parameters:
Name Type Description
userId String

The account ID to remove from the group

groupId String

ID of the group

Returns:
  • The modified group object
Type
Object

(static) group/updateGroup(groupId, newGroupData, shopId) → {Object}

Updates a permission group for a shop. Change the details of a group (name, desc, permissions etc) to the values passed in. It also goes into affected user data to modify both the groupName (using Accounts schema) and group permissions (using "accounts/removeUserPermissions")

Source:
Parameters:
Name Type Description
groupId Object

group to be updated

newGroupData Object

updated group info (similar to current group data) slug remains untouched; used as key in querying

shopId String

id of the shop the group belongs to

Returns:
  • object.status of 200 on success or Error object on failure
Type
Object