Merge remote-tracking branch 'origin/master'
This commit is contained in:
@@ -49,13 +49,14 @@ if (Meteor.isServer) {
|
||||
|
||||
// This code only runs on the server
|
||||
Meteor.publish('assetAssignments', function(assetId) {
|
||||
let query = {};
|
||||
|
||||
if(assetId) {
|
||||
query.assetId = assetId;
|
||||
}
|
||||
|
||||
return AssetAssignments.find(query);
|
||||
// let query = {};
|
||||
//
|
||||
// if(assetId) {
|
||||
// query.assetId = assetId;
|
||||
// }
|
||||
//
|
||||
// return AssetAssignments.find(query);
|
||||
return [];
|
||||
});
|
||||
}
|
||||
Meteor.methods({
|
||||
@@ -66,25 +67,25 @@ Meteor.methods({
|
||||
* @param assigneeId The Mongo ID of the Student or Staff (person._id).
|
||||
*/
|
||||
'AssetAssignments.add'(assetId, assigneeType, assigneeId) {
|
||||
check(assigneeId, String);
|
||||
check(assigneeType, String);
|
||||
check(assetId, String);
|
||||
|
||||
if(assigneeType !== 'Student' && assigneeType !== 'Staff') {
|
||||
// Should never happen.
|
||||
console.error("Error: Received incorrect assignee type in adding an assignment.");
|
||||
console.error(assigneeType);
|
||||
}
|
||||
else if(Roles.userIsInRole(Meteor.userId(), "admin", {anyScope:true})) {
|
||||
AssetAssignments.insert({assetId, assigneeType, assigneeId});
|
||||
}
|
||||
// check(assigneeId, String);
|
||||
// check(assigneeType, String);
|
||||
// check(assetId, String);
|
||||
//
|
||||
// if(assigneeType !== 'Student' && assigneeType !== 'Staff') {
|
||||
// // Should never happen.
|
||||
// console.error("Error: Received incorrect assignee type in adding an assignment.");
|
||||
// console.error(assigneeType);
|
||||
// }
|
||||
// else if(Roles.userIsInRole(Meteor.userId(), "admin", {anyScope:true})) {
|
||||
// AssetAssignments.insert({assetId, assigneeType, assigneeId});
|
||||
// }
|
||||
},
|
||||
'AssetAssignments.remove'(_id) {
|
||||
check(_id, String);
|
||||
|
||||
if(Roles.userIsInRole(Meteor.userId(), "admin", {anyScope:true})) {
|
||||
//TODO: Need to first verify there are no checked out assets to the staff member.
|
||||
}
|
||||
// check(_id, String);
|
||||
//
|
||||
// if(Roles.userIsInRole(Meteor.userId(), "admin", {anyScope:true})) {
|
||||
// //TODO: Need to first verify there are no checked out assets to the staff member.
|
||||
// }
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user