This commit is contained in:
Kenneth Jao 2016-10-10 23:06:57 -04:00
commit e225f08a6a
3 changed files with 15 additions and 28 deletions

View File

@ -37,8 +37,7 @@ ahref:dragula
harrison:papa-parse harrison:papa-parse
pfafman:filesaver pfafman:filesaver
flemay:less-autoprefixer flemay:less-autoprefixer
natestrauser:select2
juliancwirko:s-alert juliancwirko:s-alert
juliancwirko:s-alert-stackslide juliancwirko:s-alert-stackslide
yogiben:admin-edit aldeed:collection2
mfactory:admin-lte-edit yogiben:admin

View File

@ -72,7 +72,7 @@ meteor@1.2.17
meteor-base@1.0.4 meteor-base@1.0.4
meteorhacks:meteorx@1.4.1 meteorhacks:meteorx@1.4.1
meteorhacks:unblock@1.1.0 meteorhacks:unblock@1.1.0
mfactory:admin-lte-edit@0.0.2 mfactory:admin-lte@0.0.2
minifier-css@1.2.14 minifier-css@1.2.14
minifier-js@1.2.14 minifier-js@1.2.14
minimongo@1.0.17 minimongo@1.0.17
@ -84,7 +84,6 @@ modules-runtime@0.7.6
momentjs:moment@2.15.1 momentjs:moment@2.15.1
mongo@1.1.12 mongo@1.1.12
mongo-id@1.0.5 mongo-id@1.0.5
natestrauser:select2@4.0.3
npm-mongo@1.5.49 npm-mongo@1.5.49
oauth@1.1.11 oauth@1.1.11
oauth2@1.1.10 oauth2@1.1.10
@ -116,10 +115,11 @@ templating-compiler@1.2.15
templating-runtime@1.2.15 templating-runtime@1.2.15
templating-tools@1.0.5 templating-tools@1.0.5
tracker@1.1.0 tracker@1.1.0
twbs:bootstrap@3.3.6
ui@1.0.12 ui@1.0.12
underscore@1.0.9 underscore@1.0.9
url@1.0.10 url@1.0.10
webapp@1.3.11 webapp@1.3.11
webapp-hashing@1.0.9 webapp-hashing@1.0.9
yogiben:admin-edit@1.2.8 yogiben:admin@1.2.8
zimme:active-route@2.3.2 zimme:active-route@2.3.2

View File

@ -6,9 +6,6 @@ import {
Mongo Mongo
} from 'meteor/mongo'; } from 'meteor/mongo';
Houston.add_collection(Meteor.users);
Houston.add_collection(Houston._admins);
// Defines who the admins are - not added // Defines who the admins are - not added
var superadmins = [ var superadmins = [
"ybq987@gmail.com", "ybq987@gmail.com",
@ -18,22 +15,6 @@ var superadmins = [
var worktype = ["test", "quiz", "project", "normal", "other"]; var worktype = ["test", "quiz", "project", "normal", "other"];
// Adds roles to superadmins
// Not necessary on every run
// Makes superadmins
for (var i = 0; i < superadmins.length; i++) {
superadmin = Meteor.users.findOne({
"services.google.email": superadmins[i]
});
if (superadmin !== undefined && !(Roles.userIsInRole(superadmin._id, 'superadmin'))) {
Roles.addUsersToRoles(superadmin._id, 'superadmin');
Houston._admins.insert({
user_id: superadmin._id
});
}
}
Meteor.publish('schools', function() { Meteor.publish('schools', function() {
return schools.find(); return schools.find();
}); });
@ -502,9 +483,10 @@ Meteor.methods({
} }
}, },
'createProfile': function(userId) { 'createProfile': function(userId) {
var current = Meteor.users.findOne({ var currentuser = Meteor.users.findOne({
_id: userId _id: userId
}).profile; });
var current = currentuser.profile;
current.banner = "/Banners/defaultcover.jpg"; current.banner = "/Banners/defaultcover.jpg";
current.classes = [userId]; current.classes = [userId];
current.preferences = { current.preferences = {
@ -514,6 +496,12 @@ Meteor.methods({
"done": true, "done": true,
"hideReport": true "hideReport": true
}; };
if (_.contains(superadmins, currentuser.services.google.email)) {
Roles.addUsersToRoles(userId, 'superadmin');
Roles.addUsersToRoles(userId, 'admin');
}
Meteor.users.update({ Meteor.users.update({
_id: userId _id: userId
}, { }, {
@ -527,7 +515,7 @@ Meteor.methods({
var pass = input[1]; var pass = input[1];
var prof = Meteor.user().profile; var prof = Meteor.user().profile;
var found = classes.findOne({ var found = classes.findOne({
_id: change, _id: change
}); });
if (Meteor.user() !== null && if (Meteor.user() !== null &&
found !== null && found !== null &&