Meteor仅为指定用户发布所有集合(admin)

时间:2016-01-02 14:44:40

标签: javascript mongodb meteor

如何仅向<input type="text" id="answer" style="direction:RTL;" onkeydown="answer(this)">用户发布所有meteor collections? meteor {role: "admin"}包为所有客户端提供db访问权限。有没有办法使用autopublish包含一些访问限制或与访问参数类似的函数?

(作为奖励,让autopublish包具有相同的限制会很好,但这不是必要的。)

1 个答案:

答案 0 :(得分:1)

protected void beforeReport(Form f){
  Table table=new MyTable(new DefaultTableModel(columnNamesInOut,dataInOut));
  Table tablePunishment=new MyTable(new DefaultTableModel(columnNamesPunishment,dataPunishment));
  Table tableAccident=new MyTable(new DefaultTableModel(columnNamesAccident,dataAccident));
}

public class MyTable extends Table {

  public MyTable(TableModel tm) {
    super(tm, true);
  }

  public Component createCell(Object value, int row, int col, boolean editable) {
    Component component = null;
    if (value instanceof Vector) {
      Container c = new Container(new BoxLayout(BoxLayout.Y_AXIS));
      Iterator i = ((Vector) value).iterator();
      while (i.hasNext()) {
        c.addComponent(new Label(i.next().toString()));
      }
      component = c;
    } else {
      component = super.createCell(value, row, col, editable);
    }
    return component;
  }

  @Override
  protected TableLayout.Constraint createCellConstraint(Object value, int row, int column) {
    TableLayout.Constraint constraint = ((TableLayout) this.getLayout()).createConstraint();
    constraint.setVerticalAlign(CENTER);
    addComponent(constraint);

    switch (column) {
      case 0: {
        constraint.setWidthPercentage(25);
        break;
      }
      case 1: {
        constraint.setWidthPercentage(25);
        break;
      }
      case 2: {
        constraint.setWidthPercentage(25);
        break;
      }
      case 3: {
        constraint.setWidthPercentage(25);
        break;
      }
    }
    return constraint;
  }
}

这是一个匿名出版物,(null)您不需要订阅它..它将自动发布到客户端..