Skip to content

Commit

Permalink
Implemented user.getGroups(), group.getUsers().
Browse files Browse the repository at this point in the history
  • Loading branch information
steveWang committed Jul 19, 2011
1 parent bb8917b commit 68bb9f0
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
4 changes: 4 additions & 0 deletions lib/group.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ exports.initialize = function (now) {
callback(Object.keys(this.users).length);
};

Group.prototype.getUsers = function (callback) {
callback(Object.keys(this.users));
};

// Shim for backwards compatibility.
Group.prototype.connected = function (callback) {
now.on('connect', callback);
Expand Down
6 changes: 5 additions & 1 deletion lib/user.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ exports.initialize = function (now) {

now.emit.apply(user, ['disconnect']);


delete now.users[self.user.clientId];
});

Expand All @@ -104,6 +104,10 @@ exports.initialize = function (now) {
this.now = Proxy.wrap(this);
};

User.prototype.getGroups = function (callback) {
callback(Object.keys(this.groups));
};

User.prototype.get = function (fqn) {
// First look in this user's scopeTable
var value = this.scopeTable.get(fqn);
Expand Down

0 comments on commit 68bb9f0

Please sign in to comment.