Example #1
0
	"nicks.blockIllegal": {
		type: Boolean
	},
	"nicks.restrictToCASLogin": {
		type: Boolean
	}
});

SessionConfigurationCollection.attachSchema(SessionConfigurationSchema);

SessionConfigurationCollection.deny({
	insert: function () {
		return true;
	},
	update: function () {
		return true;
	},
	remove: function () {
		return true;
	}
});

SessionConfigurationCollection.allow({
	insert: function (userId, doc) {
		return localData.containsHashtag(doc.hashtag);
	},
	update: function (userId, doc) {
		return localData.containsHashtag(doc.hashtag);
	},
	remove: function (userId, doc) {
		return localData.containsHashtag(doc.hashtag);
  },
  "content": {
    type: String,
    label: "The content of this post.",
    optional: true
  },
  "tags": {
    type: [ String ],
    label: "The tags of this post.",
    optional: true
  }
});

Posts.attachSchema(Posts.schema);


/* added for extra safeguard */

Posts.allow({
  insert: () => false,
  update: () => false,
  remove: () => false
});

Posts.deny({
  insert: () => true,
  update: () => true,
  remove: () => true
});

Example #3
0
import { Mongo } from 'meteor/mongo';
import { SimpleSchema } from 'meteor/aldeed:simple-schema';



export const Pins = new Mongo.Collection('Pins');

Pins.deny({
    insert(){ return true; },
    update(){ return true; },
    remove(){ return true; },
});

Pins.schema = new SimpleSchema({
    _id: { type: String, regEx: SimpleSchema.RegEx.Id},
    title: { type: String },
    createdAt: { type: Date,  denyUpdate: true },
    userId: { type: String, regEx: SimpleSchema.RegEx.Id, optional: true },
    url: { type: String, regEx: SimpleSchema.RegEx.Url },
});

Pins.publicFields = {
    title: 1,
    createdAt: 1,
    url: 1,
    userId: 1,
};

//"meteor add aldeed:collection2" required
Pins.attachSchema(Pins.schema);
import { Mongo } from 'meteor/mongo';
import SimpleSchema from 'simpl-schema';

export const LeaguePickExpectedWins = new Mongo.Collection('league_pick_expected_wins');

LeaguePickExpectedWins.schema = new SimpleSchema({
  leagueId: {
    type: String,
    regEx: SimpleSchema.RegEx.Id,
  },
  rank: {
    type: SimpleSchema.Integer,
  },
  wins: {
    type: Number,
  },
});

LeaguePickExpectedWins.attachSchema(LeaguePickExpectedWins.schema);

LeaguePickExpectedWins.deny({
  insert() { return true; },
  update() { return true; },
  remove() { return true; },
});
import { Mongo } from 'meteor/mongo';
import { SimpleSchema } from 'meteor/aldeed:simple-schema';
import { Factory } from 'meteor/dburles:factory';


export const Sequence = new Mongo.Collection('sequence');

Sequence.allow({
	insert: () => false,
	update: () => false,
	remove: () => false
});

Sequence.deny({
	insert: () => true,
	update: () => true,
	remove: () => true
});

Sequence.Schema = new SimpleSchema({
	 _id:{
     type:String,
     label: "the name of document that will use increment value"
   },
   seq:{
     type:Number,
     label: "the value of the Sequence"
   }
});

Sequence.attachSchema(Sequence.Schema);
Example #6
0
Meteor.users.deny({
  update() { return true; }
});


export const Profiles = new Mongo.Collection('profiles');

Profiles.allow({
  insert() { return false; },
  update() { return false; },
  remove() { return false; }
});

Profiles.deny({
  insert() { return true; },
  update() { return true; },
  remove() { return true; }
});

let ProfilesSchema = new SimpleSchema({
    "username": {
    type: String,
    label: "The username of the user."
  },
    "authorname": {
        type: String,
        label: "The chosen author name of the user."
    },
  "avatar": {
    type: String,
    label: "The url of the user's avatar.",
	// 	return Meteor.users.find({'profile.organizationId': this._id});
	// },
	// events() {
	// 	return Events.find({org: this._id});
	// },
	// logo() {
	// 	return Images.findOne();
	// },
	// cover() {
	// 	return Images.findOne();
	// }
});


/*
 * Collection permissions
 * Deny all actions on client-side
 *
 */
Sponsors.deny({
	insert() {
		return true;
	},
	update() {
		return true;
	},
	remove() {
		return true;
	}
});
import { Mongo } from 'meteor/mongo';
import { SimpleSchema } from 'meteor/aldeed:simple-schema';

export const BattleJoinGroups = new Mongo.Collection('BattleJoinGroups');

BattleJoinGroups.deny({
  insert() { return true; },
  update() { return true; },
  remove() { return true; }
});

BattleJoinGroups.schema = new SimpleSchema({
  battleId : {
    type  : String,
    label : 'battle id',
    min   : 1
  },
  groupId : {
    type  : String,
    label : 'battle join group id',
    min   : 1
  }
});

BattleJoinGroups.attachSchema(BattleJoinGroups.schema);
Example #9
0
export const BannedNicksCollection = new Mongo.Collection("bannedNicks");
export const bannedNicksCollectionSchema = new SimpleSchema({
	userNick: {
		type: userNickSchema
	}
});

BannedNicksCollection.attachSchema(bannedNicksCollectionSchema);

BannedNicksCollection.deny({
	insert: function () {
		return true;
	},
	update: function () {
		return true;
	},
	remove: function () {
		return true;
	}
});

BannedNicksCollection.allow({
	insert: function (userId, doc) {
		return localData.containsHashtag(doc.hashtag);
	},
	update: function (userId, doc) {
		return localData.containsHashtag(doc.hashtag);
	},
	remove: function (userId, doc) {
		return localData.containsHashtag(doc.hashtag);
Example #10
0
import { Mongo } from 'meteor/mongo';
import { SimpleSchema } from 'meteor/aldeed:simple-schema';
import { Collection2 } from 'meteor/aldeed:collection2';

import { Config } from '../../config.js';

export const Localnets = new Mongo.Collection('Localnets');

Localnets.deny({
	insert(){ return true; },
	update(){ return true; },
	remove(){ return true; }
});

Localnets.schema = new SimpleSchema({
	localnetsID: {
		label: 'Localnets ID',
		type: String
	},
	post: {
		label: 'Localnets Post',
		type: Object,
		blackbox: true
	}
});

Localnets.attachSchema( Localnets.schema );

Localnets.publicFields = {
	tweet: 1
};
Example #11
0
import {Mongo} from 'meteor/mongo';
import {SimpleSchema} from 'meteor/aldeed:simple-schema';

import {denyAll, defaultSchema} from '../common';

export const Credentials = new Mongo.Collection("credentials");

// Deny all client-side access (management through methods)
Credentials.deny(denyAll);

Credentials.schema = new SimpleSchema({
    ...defaultSchema,
    domain: {
        type: String
    },
    identifier: {
        type: String
    },
    password: {
        type: String
    },
    iv: {
        type: String
    }
});

Credentials.attachSchema(Credentials.schema);

Credentials.helpers({
    isOwner(userId) {
        return this.ownerId = userId;
Example #12
0
import { Meteor } from 'meteor/meteor';
import { Mongo } from 'meteor/mongo';
import { check } from 'meteor/check';

export const Portfolio = new Mongo.Collection('portfolio');

if (Meteor.isServer) {
  Meteor.publish('portfolio', function () {
    return Portfolio.find();
  });

  Meteor.publish('portfolio-item', function (title) {
    check(title, String);

    return Portfolio.find({ title: new RegExp(title.replace(new RegExp('-', 'g'), ' '), 'i') });
  });
}

Portfolio.deny({
  insert() { return true; },
  update() { return true; },
  remove() { return true; }
});
Example #13
0
import { Mongo } from 'meteor/mongo';
import { Meteor } from 'meteor/meteor';
//账本表
export const Bills = new Mongo.Collection('bills');

let isOwner = function(userId, bills) {
    return bills && bills.owner === userId;
}
Bills.allow({
    update: function(userId, bills) { return isOwner(userId, bills); },
    remove: function(userId, bills) { return isOwner(userId, bills); }
});
Bills.deny({
    update: function(userId, bills, fieldNames) {
        // 只能更改如下两个字段:
        return (_.without(fieldNames, 'title', 'description').length > 0);
    }
});

Example #14
0
        this.unset();
      }
    }
  },
}));

/*Posts.allow({
  insert(userId){
    return !! userId;
  },
});*/

function validatePost(post) {
  const errors = {};
  if (!post.title) errors.title = 'please fill in a headline';
  if (!post.url) errors.url = 'please fill in a url';
  return errors;
};
Posts.allow({
  update: ownsDocument,
  remove: ownsDocument,
});

Posts.deny({
  update(userId,post,filedNames){
    //_.without(array,*values)返回一个删除所有values值后的array副本
    return (_.without(filedNames,'url','title').length > 0);
  }
});
export { Posts,validatePost };
import { Mongo } from 'meteor/mongo';
import { SimpleSchema } from 'meteor/aldeed:simple-schema';

export const BookSearch = new Mongo.Collection('BookSearch');

BookSearch.allow({
  insert: () => false,
  update: () => false,
  remove: () => false,
});

BookSearch.deny({
  insert: () => true,
  update: () => true,
  remove: () => true,
});

BookSearch.schema = new SimpleSchema({
  oclc: {
    type: String,
    label: 'Open Library OCLC number',
  },
  search: {
    type: String,
    label: 'Search String used to find this book.',
  },
  coverUrl: {
    type: String,
    label: 'Medium size cover page',
  }
});
Example #16
0
    return true;
  },
  update: function(){
    return true;
  },
  remove: function(){
    return true;
  }
});

Buildings.deny({
  insert: function(){
    return false;
  },
  update: function(){
    return false;
  },
  remove: function(){
    return false;
  }
});

if(Meteor.isServer){

  if(Buildings.find().count() === 0){
      var buildings  = [
        {name:"ЖК Гранд Астана", year:2014, builder:"ТОО ЖилСтройСервис"},
        {name:"ЖК Комфорт таун", year:2015, builder:"ТОО Bi Group"}
      ];

      _.each(buildings, function(item){
		return Meteor.users.find({'profile.organizationId': this._id});
	},
	events() {
		return Events.find({org: this._id});
	},
	// logo() {
	// 	return Images.findOne();
	// },
	// cover() {
	// 	return Images.findOne();
	// }
});


/*
 * Collection permissions
 * Deny all actions on client-side
 *
 */
Organizations.deny({
	insert() {
		return true;
	},
	update() {
		return true;
	},
	remove() {
		return true;
	}
});
Example #18
0
function loadHarvestSchema() {
  const HarvestSchema = new SimpleSchema({
    _id: {
      type: String
    },
    name: {
      type: String
    },
    url: {
      type: String,
      unique: true,
      label: "URL"
    },
    organization: {
      type: String,
      label: "Organization"
    },
    /* harvest interval in seconds.  Initialize to null to indicate no harvest
    * made */
    last_harvest_dt: {
      type: null,
      optional: true
    },
    harvest_interval: {
      type: Number,
      optional: true,
      defaultValue: 1
    },
    harvest_type: {
      type: String,
      allowedValues: ['WAF', 'ERDDAP-WAF', 'CSW'],
      defaultValue: 'WAF' 
    },
    publish: {
      type: Boolean,
      defaultValue: false,
      label: "Publish this source?"
    },
    harvest_contact: {
      type: String,
      defaultValue: harvestUserEmail,
      optional: true,
      label: "Contact"
    }
  });
  Harvests.schema = HarvestSchema;     

  // add public Fields
  Harvests.publicFields = {
    _id: 1,
    name: 1,
    url: 1,
    organization: 1,
    last_harvest_dt: 1,
    harvest_interval: 1,
    harvest_type: 1,
    publish: 1,
    harvest_contact: 1
  };

  Harvests.attachSchema(HarvestSchema);

  if (Meteor.isClient) {
    Harvests.allow({
      insert(userId, doc) {
        return false;
      },

      update(userId, doc, fieldNames, modifier) {
        return false;
      },

      remove(userId, doc) {
        return false;
      }
    });

    Harvests.deny({
      insert(userId, doc) {
        return true;
      },

      update(userId, doc, fieldNames, modifier) {
        return true;
      },

      remove(userId, doc) {
        return true;
      }
    });
  }
}
import { Mongo } from 'meteor/mongo';
import { SimpleSchema } from 'meteor/aldeed:simple-schema';
import { Factory } from 'meteor/dburles:factory';
import faker from 'faker';

export const NotificationMessage = new Mongo.Collection('notification-message');

NotificationMessage.allow({
	insert: () => false,
	update: () => false,
	remove: () => false
});

NotificationMessage.deny({
	insert: () => true,
	update: () => true,
	remove: () => true
});


NotificationMessage.Schema = new SimpleSchema({
	messageId: { 
		type: String ,
		label: 'The id of the message'
	},
	receiver: {
		type: String,
		label: 'The id of the receiver '
	}	
});
Example #20
0
/**
 * Created by wxl on 2016/6/29.
 */
import { Mongo } from 'meteor/mongo';

export const Records = new Mongo.Collection('records');

let isOwner = function(userId, records) {
    return records && records.owner === userId;
}
Records.allow({
    update: function(userId, records) { return isOwner(userId, records); },
    remove: function(userId, records) { return isOwner(userId, records); }
});
Records.deny({
    update: function(userId, records, fieldNames) {
        return (_.without(fieldNames, 'spendTime', 'description','money').length > 0);
    }
});
import { Mongo } from 'meteor/mongo';
import { SimpleSchema } from 'meteor/aldeed:simple-schema';
import faker from 'faker';
import { Factory } from 'meteor/dburles:factory';

export const NotificationComment = new Mongo.Collection('notifications-comment');

NotificationComment.allow({
	insert: () => false,
	update: () => false,
	remove: () => false
});

NotificationComment.deny({
	insert: () => true,
	update: () => true,
	remove: () => true
});

NotificationComment.Schema = new SimpleSchema({
	annonce_id: { 
		type: String , 
		label:'Notification - the annonce id' 
	} ,				
	commentId: { 
		type: String , 
		label: 'Notification - the comment id'
	},
	owner: { 
		type: String , 
		label: 'Notification - the id of the owner of notification'
Example #22
0
import { Mongo } from 'meteor/mongo';
import { SimpleSchema } from 'meteor/aldeed:simple-schema';
import { Factory } from 'meteor/dburles:factory';

export const Settings = new Mongo.Collection('Settings');

Settings.allow({
  insert: () => false,
  update: () => false,
  remove: () => false,
});

Settings.deny({
  insert: () => true,
  update: () => true,
  remove: () => true,
});

Settings.schema =  new SimpleSchema({
  sendAudioChecked: {
    type: Boolean
  },
  sendVideoChecked: {
    type: Boolean
  },
  receiveAudioChecked: {
    type: Boolean
  },
  receiveVideoChecked: {
    type: Boolean
  },
Example #23
0
import { Mongo } from 'meteor/mongo'
import { SimpleSchema } from 'meteor/aldeed:simple-schema'

const Pictures = new Mongo.Collection('pictures')

Pictures.deny({
  insert() { return true },
  update() { return true },
  remove() { return true },
})

const PictureSchema = new SimpleSchema({
  name: {
    type: String,
  },
  url: {
    type: SimpleSchema.RegEx.Url,
  },
  gallery: {
    type: String,
    regEx: SimpleSchema.RegEx.Id,
  },
  weight: {
    type: Number,
    defaultValue: 100,
  },
})

Pictures.attachSchema(PictureSchema)

export { Pictures }
Example #24
0
import { Mongo } from 'meteor/mongo';
import { SimpleSchema } from 'meteor/aldeed:simple-schema';

export const MapCells = new Mongo.Collection('MapCells');
export const RangeMapCells = new Mongo.Collection('RangeMapCells');

MapCells.deny({
  insert() { return true; },
  update() { return true; },
  remove() { return true; }
});

MapCells.schema = new SimpleSchema({
  mapId : {
    type  : String,
    label : 'map id',
    min   : 1
  },
  index : {
    type  : Number,
    label : 'frame index'
  },
  mapx : {
    type  : Number,
    label : 'map x'
  },
  mapy : {
    type  : Number,
    label : 'map y'
  }
});
import { Mongo } from 'meteor/mongo';
import { SimpleSchema } from 'meteor/aldeed:simple-schema';


export const ConversationMessages = new Mongo.Collection('conversation-messages');

ConversationMessages.allow({
  insert: () => false,
  update: () => false,
  remove: () => false
});


ConversationMessages.deny({
  insert: () => true,
  update: () => true,
  remove: () => true
});

ConversationMessages.schema = new SimpleSchema({
  conversationId: {
    type: String,
    label: "The id of the conversation that comporte all ConversationMessages"
  },
  "from.userId":{
    type: String,
    label: "the id of the sender"
  },
  "to.userId":{
    type: String,
    label: "the revericer of the message"
Example #26
0
};
export const nicknameCategoriesCollectionSchema = new SimpleSchema({
	nick: userNickSchema,
	nickCategory: nickCategorySchema,
	insertDate: insertDateSchema,
	lastUsedDate: lastUsedDateSchema
});

NicknameCategoriesCollection.attachSchema(nicknameCategoriesCollectionSchema);

NicknameCategoriesCollection.deny({
	insert: function () {
		return true;
	},
	update: function () {
		return true;
	},
	remove: function () {
		return true;
	}
});

NicknameCategoriesCollection.allow({
	insert: function () {
		return false;
	},
	update: function () {
		return false;
	},
	remove: function () {
		return false;
Example #27
0
	deny(...args) {
		return this.model.deny(...args);
	}
import { SimpleSchema } from 'meteor/aldeed:simple-schema';
import { Factory } from 'meteor/dburles:factory';
import faker from 'faker';


export const NotificationAnnonce = new Mongo.Collection('notification-annonce');

NotificationAnnonce.allow({
	insert: () => false,
	update: () => false,
	remove: () => false
});

NotificationAnnonce.deny({
	insert: () => true,
	update: () => true,
	remove: () => true
});

NotificationAnnonce.Schema = new SimpleSchema({

	userId: {
		type: String,
		label: 'The id of the notifed'
	},
	annonceId: {
		type: String,
		label: 'The id of the annonce'
	},
	publication: {
		type: Date,
Example #29
0
import faker from 'faker';
import { Mongo } from 'meteor/mongo';
import { SimpleSchema } from 'meteor/aldeed:simple-schema';
import { Factory } from 'meteor/dburles:factory';

export const Pictures = new Mongo.Collection('Pictures');

Pictures.allow({
  insert: () => false,
  update: () => false,
  remove: () => false,
});

Pictures.deny({
  insert: () => true,
  update: () => true,
  remove: () => true,
});

Pictures.schema = new SimpleSchema({
  title: {
    type: String,
    label: 'The title of the picture.',
  },
  src:{
    type: String,
    label: 'The source of the picture.',
  },
  ownerId:{
    type: String,
    label: 'The owner of the picture.',
Example #30
0
import { Mongo } from 'meteor/mongo'

const Categories = new Mongo.Collection('categories')

Categories.deny({
  insert: () => true,
  update: () => true,
  remove: () => true,
})

export default Categories