• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

TypeScript meteor.Meteor.users类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了TypeScript中meteor/meteor.Meteor.users的典型用法代码示例。如果您正苦于以下问题:TypeScript Meteor.users类的具体用法?TypeScript Meteor.users怎么用?TypeScript Meteor.users使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了Meteor.users类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。

示例1: function

  invite: function (partyId:string, userId:string) {
    check(partyId, String);
    check(userId, String);
 
    let party = Parties.findOne(partyId);
 
    if (!party)
      throw new Meteor.Error('404', 'No such party!');
 
    if (party.public)
      throw new Meteor.Error('400', 'That party is public. No need to invite people.');
 
    if (party.owner !== this.userId)
      throw new Meteor.Error('403', 'No permissions!');
 
    if (userId !== party.owner && (party.invited || []).indexOf(userId) == -1) {
      Parties.update(partyId, {$addToSet: {invited: userId}});
 
      let from = getContactEmail(Meteor.users.findOne(this.userId));
      let to = getContactEmail(Meteor.users.findOne(userId));
 
      if (Meteor.isServer && to) {
        Email.send({
          from: '[email protected]',
          to: to,
          replyTo: from || undefined,
          subject: 'PARTY: ' + party.name,
          text: `Hi, I just invited you to ${party.name} on Socially.
                        \n\nCome check it out: ${Meteor.absoluteUrl()}\n`
        });
      }
    }
  },
开发者ID:ElijahWolfe,项目名称:socially,代码行数:33,代码来源:methods.ts


示例2: function

  Meteor.publish(GAME_SUBSCRIPTION_NAME, function (options:GameSubscriptionOptions) {
    if (!this.userId) {
      log.warn('Subscription denied due to no userId');
      return this.ready(); // Must be logged in
    }
    let gameUserIds:string[] = [];
    let handsCursor = HandCollection.find({gameId: options.gameId});
    handsCursor.forEach((game:Hand)=> {
      gameUserIds.push(game.userId);
    });
    if (gameUserIds.indexOf(this.userId)===-1) {
      let user:Meteor.User = Meteor.users.find({_id: this.userId});
      if (!AccountsAdminTools.isAdmin(user))
        return this.ready(); // Game only visible to its players or admins
    }
    let userCursor =  Meteor.users.find(
      {_id: {$in: gameUserIds}},
      {
        fields: {
          username: true,
          profile: true,
          emails: true
        }
      }
    );
    let actionCursor = GamePlayActionCollection.find({gameId: options.gameId});
//    log.debug("publish gameinfo: " + ", GameId:" + options.gameId +  ", userCount: " + userCursor.count(), ", hands count: " + handsCursor.count(), " action count:" + actionCursor.count())
    return [
      userCursor,
      handsCursor,
      actionCursor
    ];
  });
开发者ID:kokokenada,项目名称:for-real-cards,代码行数:33,代码来源:game.publications.ts


示例3: function

  invite: function (trackId:string, userId:string) {
    check(trackId, String);
    check(userId, String);

    let track = Tracks.collection.findOne(trackId);

    if (!track)
      throw new Meteor.Error('404', 'No such track!');

    if (track.public)
      throw new Meteor.Error('400', 'That track is public. No need to invite people.');

    if (track.owner !== this.userId)
      throw new Meteor.Error('403', 'No permissions!');

    if (userId !== track.owner && (track.invited || []).indexOf(userId) == -1) {
      Tracks.collection.update(trackId, {$addToSet: {invited: userId}});

      let from = getContactEmail(Meteor.users.findOne(this.userId));
      let to = getContactEmail(Meteor.users.findOne(userId));

      if (Meteor.isServer && to) {
        Email.send({
          from: '[email protected]',
          to: to,
          replyTo: from || undefined,
          subject: 'TRACK: ' + track.name,
          text: `Hi, I just invited you to ${track.name} on Beetrut.
                        \n\nCome check it out: ${Meteor.absoluteUrl()}\n`
        });
      }
    }
  },
开发者ID:harishmaiya,项目名称:gundmi48-gadikatte58,代码行数:33,代码来源:tracks.methods.ts


示例4:

Meteor.startup(function () {

  if (Meteor.users.find().fetch().length === 0) 
  {
    var users = [
        {name:"Test1",email:"[email protected]",roles:[]},
        {name:"Test2",email:"[email protected]",roles:[]},
        {name:"Test3",email:"[email protected]",roles:[]},
        {name:"Admin",email:"[email protected]",roles:['admin']}
      ];

	for (var i = 0; i < users.length; i++) 
	{      
      console.log(users[i]);
      var id = Accounts.createUser({
        email: users[i].email,
        password: "password",
        profile: { name: users[i].name }
      });
      // email verification
      Meteor.users.update({_id: id}, {$set:{'emails.0.verified': true}});
      Roles.addUsersToRoles(id, users[i].roles); 
    }
  }

});
开发者ID:Feldor,项目名称:society,代码行数:26,代码来源:main.ts


示例5: function

Meteor.publish('users.list', function(options: Object, email: string) {
  // if(options != undefined){
  console.log("?", options);
  let _op = options;

    Counts.publish(this, 'numberOfUsers',
       Meteor.users.find({}), { noReady: true });
    return Meteor.users.find({}, _op);
  // }
});
开发者ID:p3140,项目名称:angular2-meteor-starter-kit,代码行数:10,代码来源:users.ts


示例6: function

Meteor.publish("users", function (options: Object, searchString: string) {



    var search = new RegExp('.*' + searchString, 'i');
    console.log(search)

    Counts.publish(this, 'numberOfRecords', Meteor.users.find({ 'emails.address': search }), { noReady: true });
    // return Meteor.users.find({selector}, { fields: { 'emails.address': 1, profile: 1, roles: 1, createdAt: 1, width: 1, height: 1, imageAsData: 1 } });
    return Meteor.users.find({ 'emails.address': search }, options);
});
开发者ID:admirkb,项目名称:ads,代码行数:11,代码来源:users.ts


示例7: function

  setCustomSystem: function(name) {
    name = name.trim().toLowerCase();
    let character = Characters.findOne({
      uid: this.userId
    });
    if (character == null) {
      throw new Meteor.Error('error', 'The server does not know about your character.');
    }
    if (!((character.roles != null) && character.roles.indexOf('admin') >= 0)) {
      throw new Meteor.Error('error', 'You are not authorized to perform this action.');
    }
    let user = Meteor.users.findOne({_id: this.userId});
    if (!user) {
      throw new Meteor.Error('error', 'The server does not know about your character.');
    }
    let fsys = SolarSystems.findOne({name_lower: name});
    if (!fsys) {
      throw new Meteor.Error('error', 'Cannot find the requested system.');
    }

    return Settings.update({
      _id: 'incursion'
    }, {
      $set: {
        sysid: parseInt(fsys._id, 10),
        sysname: fsys.name,
      }
    });
  },
开发者ID:paralin,项目名称:evewaitlist,代码行数:29,代码来源:methodsb.ts


示例8: getUser

function getUser(): {username: String, userId: String} {
    if (this.userId) {
        return Meteor.users.findOne({_id: this.userId})
    } else {
        return Meteor.user();
    }
}
开发者ID:Puzochacha,项目名称:rhy,代码行数:7,代码来源:game.ts


示例9: sendPost

  sendPost(p) {
    let name = Meteor.users.findOne(Meteor.userId()).profile.name;
    Meteor.call('simpanPost', {
      idUser: Meteor.userId(),
      name: name,
      status: p,
      dateTime: new Date(),
      comments: [],
      likes: []
    }, (error) => {
      if (error) {
        console.log(error);
      }
      this.inputPost = '';

      Meteor.call('simpanTimeLine', {
        dateTime: new Date(),
        status: 'post',
        message: `${name} send post '${p}'`
      }, (error) => {
        if (error) {
          console.log(error);
        }
      });
    });
  }
开发者ID:RizkiMufrizal,项目名称:Socially-Angular2-Meteor,代码行数:26,代码来源:post-component.ts


示例10:

Accounts.registerLoginHandler(function(loginRequest){ 
    //console.log(this.connection);
    //console.log(loginRequest);
    if(!loginRequest.apacheUser){
        return undefined;
    }
    let userId = null;
    let user = Meteor.users.findOne(loginRequest.apacheUser);
    if(!user){
        userId = Meteor.users.insert({_id: loginRequest.apacheUser, 
                                     username: loginRequest.apacheUser});
    }else{
        userId = user._id;
    }
    return {userId: userId};
});
开发者ID:yk,项目名称:damgr,代码行数:16,代码来源:main.ts



注:本文中的meteor/meteor.Meteor.users类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
TypeScript mongo.Mongo.Collection类代码示例发布时间:2022-05-25
下一篇:
TypeScript meteor.Meteor类代码示例发布时间:2022-05-25
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap