26 lines
710 B
JavaScript
26 lines
710 B
JavaScript
import {Mongo} from "meteor/mongo";
|
|
import {Meteor} from "meteor/meteor";
|
|
import { Roles } from 'meteor/alanning:roles';
|
|
|
|
export const Staff = new Mongo.Collection('staff');
|
|
|
|
if (Meteor.isServer) {
|
|
// This code only runs on the server
|
|
Meteor.publish('staff', function(siteId) {
|
|
return Staff.find({siteId});
|
|
});
|
|
}
|
|
Meteor.methods({
|
|
'staff.add'(firstName, lastName, email, siteId) {
|
|
if(Roles.userIsInRole(Meteor.userId(), "admin", {anyScope:true})) {
|
|
Staff.insert({firstName, lastName, email, siteId});
|
|
}
|
|
},
|
|
'staff.remove'(_id) {
|
|
if(Roles.userIsInRole(Meteor.userId(), "admin", {anyScope:true})) {
|
|
//TODO: Need to first verify there are no checked out assets to the staff member.
|
|
}
|
|
},
|
|
});
|
|
|