Exemplo n.º 1
0
Meteor.startup(() => {
  AuditManager.stopAudit();

  if (!Meteor.roles.find().count()) {
    _.each(UserRoles, (name) => {
      Meteor.roles.insert({ name });
    });
  }

  const fixturesPath = 'fixtures';
  const fixturesConfigsEJSON = path.join(fixturesPath, 'configs.json');
  const fixturesConfigs = EJSON.parse(Assets.getText(fixturesConfigsEJSON));

  _.each(fixturesConfigs, (assetsDir, collectionName) => {
    const collection = getAttributeValue(global, collectionName);

    if (collection.find().count()) {
      return;
    }
    assetsDir = path.join(fixturesPath, assetsDir);
    const assets = getAssets(assetsDir);
    if (assets.length) {
      fillCollection(collection, assets);
      return logAction(assets.length, collectionName);
    }
  });

  // insertMessageFixtures(1000);

  AuditManager.startAudit();
});
Exemplo n.º 2
0
import { Meteor } from 'meteor/meteor';
import { Template } from 'meteor/templating';
import { Roles } from 'meteor/alanning:roles';
import { updateRole } from '/imports/api/users/methods';
import './manage_users_roles_item.html';

Template.manageUsersRolesItem.helpers({
  roles() {
    return Meteor.roles.find({}, { sort: { hierarchy: 1 } });
  },
  btnColor() {
    if (Template.instance().data.role === this.name) {
      return ColorMap.users.role[this.name];
    }
    return 'default';
  },
  getIcon() {
    return Icons.roles[this.name] || Icons.roles.default;
  },
  getDisplayName() {
    if (this.username) {
      return this.username;
    }
    if (this.emails && this.emails.length) {
      return this.emails[0].address;
    }
    if (this.fullName) {
      return this.fullName;
    }
    return 'unknown';
  },
Meteor.publish('users.roles', function (){
   return Meteor.roles.find();
})
Exemplo n.º 4
0
Meteor.publish('roles', function (){
    return Meteor.roles.find({});
});
Exemplo n.º 5
0
Meteor.publish(null, function () {
    return Meteor.roles.find();
});
Exemplo n.º 6
0
Meteor.publish(null, function (){
  return Meteor.roles.find(this.userId, {fields: {role: 1}});
});
Exemplo n.º 7
0
Meteor.publish("roles", function (){
    if (this.userId) {
      Meteor._sleepForMs(700);
    }
    return Meteor.roles.find({});
});
Exemplo n.º 8
0
 _.each(UserRoles, (name) => {
   Meteor.roles.insert({ name });
 });
Exemplo n.º 9
0
Meteor.publish('roles', () => Meteor.roles.find())