Display only users with a specific role in the meteor table

My site allows users to apply by connecting their google account, as soon as the account is created, they are given a "pending" role (using alanning: roles ). I would like to have a table for administrators to see when new applicants apply, from there the administrator can correctly manage the user's application (change role accepted, rejected, etc.). So, I created my table, but it shows all the users, I wonder if anyone knows a way to make sure that only users with a "waiting" role are shown in my table?

Here is what I still have:

 TabularTables.ManageApplications = new Tabular.Table({
   name: 'ManageApplications',
   collection: Meteor.users,
   allow: function (userId) {
     return Roles.userIsInRole(userId, 'admin');
   },
   autoWidth: false,
   oLanguage: {
       "sSearch": "Search: "
   },
   columns: [
     { data: //column details here },
     { data: //column details here },
     { data: //column details here },
     { data: //column details here },
     { data: //column details here },
   ],
 });

, ( "" ).

, :

 Meteor.publish("pendingUsers", function() {
   var isAdmin = Roles.userIsInRole(this.userId, 'admin');
     if (isAdmin) {
       return Roles.getUsersInRole('pending').fetch();
     } else {
       return null;
     }
 });

, pub: "pendingUsers", . , "" , - , .

- , , , , ... , " " readme, , . .

0
3

, :

selector: function(userId) {
    return {
        _id: {$in: Roles.getUsersInRole('pending')
                        .map(function(user){ return user._id} ) }
    }
},
0

, , , , , /. , .find() , .

:

selector: function( userId ) {
  return Roles.getUsersInRole('pending');
}

.fetch() btw, Roles.getUsersInRole() Meteor.users.

0

: https://github.com/aldeed/meteor-tabular#modifying-the-selector

:

     selector: function (userId) {
       return 'roles.myrole': {$exists: true}};
     },

:

     selector: function (userId) {
       return 'roles.myrole': {$in: ['viewer', 'editor']}};
     },
0

All Articles