groupaccount
Use the groupaccount
packages to provide qualified access to a single Meteor account from one or more sets of credentials:
-
groupaccount
- Provides the core, server-side functionality, along with some client-side wrappers and helpers. -
groupaccount-signin
- Provides an unstyled, reactive signin UI template -
groupaccount-manager
- Provides an unstyled, reactive management UI template
Some helpful definitions
-
accountSelector
: a globally-unique identifier for the account. Associated with a singleMeteor.user
-
memberSelector
: locally-unique identifier for someone allowed to read/write some or all data associated with the group
Usage
Add the package thus:
meteor add verody:groupaccount
Examples
Callback functions for the GroupAccounts.*
methods all have the same signature and return semantics:
var params = {
accountAdminPassword: 'thisIsASeriousPassword',
accountSelector: 'joes-group-account',
accountAdminEmail: 'joes-group@example.com'
};
GroupAccounts.createAccount (params, function (err,res) {
//
// err is undefined on successful invocation.
// res is the Meteor.userId for the new account.
console.log ('[groupaccount test createAccount CB]', res, err);
});
The callback for Meteor.loginWithGroupAccount follows the convention for the Meteor.loginWith* methods:
var params = {
accountSelector: 'joes-group-account',
memberSelector: 'admin',
memberPassword: 'thisIsASeriousPassword'
};
Meteor.loginWithGroupAccount (params, function (err) {
//
// err is undefined on successful invocation.
console.log ('[groupaccount test loginWithGroupAccount CB]', err);
});
Also, take a look at the examples on github
. And there may be a live demo running here.
Pipeline
-
member roles to facilitate access control to portions of the
Meteor.user()
data.
API Reference
-
groupaccount
-
~Meteor
:object
-
~GroupAccounts
:object
-
~meteorLoginWithFooCB
:function
-
~groupAccountsCB
:function
-
~groupAccountStatusObject
:Object
-
groupaccount~Meteor
: object
Kind: inner namespace of groupaccount
Meteor.loginWithGroupAccount(params, callback)
Log in to existing group account. Fails if member activation is pending. Asynchronous.
Kind: static method of Meteor
Param | Type | Description |
---|---|---|
params | Object |
invocation parameters |
params.memberSelector | string |
|
params.memberPassword | string |
|
callback | meteorLoginWithFooCB |
invoked upon completion |
groupaccount~GroupAccounts
: object
Kind: inner namespace of groupaccount
-
~GroupAccounts
:object
GroupAccounts.createAccount(params, callback)
Creates a new group account via asynchronous server method invocation Callback throws an error, or returns a Meteor.users document
Kind: static method of GroupAccounts
Param | Type | Description |
---|---|---|
params | Object |
invocation parameters |
params.accountSelector | string |
|
params.accountAdminEmail | email |
|
params.accountAdminPassword | string |
|
callback | groupAccountsCB |
invoked upon completion |
GroupAccounts.configure(params, callback)
Reports, and optionally modifies, configuration paramters for currently-logged-in group account. Asynchronous. On success, callback returns the current (and possibly updated) configuration parameters.
Kind: static method of GroupAccounts
Param | Type | Description |
---|---|---|
params | object |
parameters to configure |
[params.pendingLimit] | number |
|
callback | groupAccountsCB |
invoked upon completion |
GroupAccounts.joinGroup(params, callback)
Adds a new member to existing group. Asynchronous. On success callback returns a Meteor.users document ID for this group account
Kind: static method of GroupAccounts
Param | Type | Description |
---|---|---|
params | object |
parameters |
params.accountSelector | string |
|
params.memberSelector | string |
|
params.memberPassword | string |
|
callback | groupAccountsCB |
invoked upon completion |
GroupAccounts.removeMember(params, callback)
Removes an existing existing user from a group. Must be logged in to group account. Asynchronous. On success, callback returns a Meteor.users document for this group account
Kind: static method of GroupAccounts
Param | Type | Description |
---|---|---|
params | object |
parameters |
params.memberSelector | string |
|
callback | groupAccountsCB |
invoked upon completion |
GroupAccounts.activateMember(params, callback)
Activates a new group member. Must be logged in to group account. Asynchronous. On success, callback returns the Meteor.Users doument ID for this group account.
Kind: static method of GroupAccounts
Param | Type | Description |
---|---|---|
params | Object |
invocation parameters |
params.memberSelector | string |
|
callback | groupAccountsCB |
invoked upon completion |
GroupAccounts.deactivateMember(params, callback)
Dectivates a group member. Must be logged in to group account. Asynchronous. On success, callback returns the Meteor.Users doument ID for this group account.
Kind: static method of GroupAccounts
Param | Type | Description |
---|---|---|
params | Object |
invocation parameters |
params.memberSelector | string |
|
callback | groupAccountsCB |
invoked upon completion |
GroupAccounts.probe(params, callback)
⇒ groupAccountStatusObject
Throttled probe of group account and, optionally, a group member. Asynchronous. On success, callback returns a status object for the group acccount.
Kind: static method of GroupAccounts
Returns: groupAccountStatusObject
- Well, the callback returns one of these, if it wants.
Param | Type | Description |
---|---|---|
params | Object |
invocation parameters |
params.accountSelector | string |
|
[params.memberSelector] | string |
|
callback | groupAccountsCB |
invoked upon completion |
groupaccount~meteorLoginWithFooCB
: function
Callback functions for the MeteorLoginWith* methods. Returns a Meteor.Error on early failure. Otherwise, returns an object with userId set to Meteor.users document ID for this group account, and perhaps error set to a Meteor.Error.
Kind: inner typedef of groupaccount
Param | Type | Description |
---|---|---|
err | Meteor.Error |
undefined on successful invocation |
groupaccount~groupAccountsCB
: function
Callback functions for the GroupAccounts.* methods all have the same signature and return semantics.
Kind: inner typedef of groupaccount
Param | Type | Description |
---|---|---|
err | Meteor.Error |
undefined on successful invocation |
result | Object |
varies |
groupaccount~groupAccountStatusObject
: Object
A group account probe status object.
Kind: inner typedef of groupaccount
Properties
Name | Type |
---|---|
validNewGroup | boolean |
validOldGroup | boolean |
validNewMember | boolean |
validOldMember | boolean |
membershipOpen | boolean |
© 2015-2016 Verody, LLC.