Merge remote-tracking branch 'telescope/master' into at-integration

This commit is contained in:
Luca Mussi 2014-09-24 07:37:08 +02:00
commit efe9e5d38b
7 changed files with 43 additions and 22 deletions

View file

@ -46,6 +46,15 @@ Schema.User = new SimpleSchema({
// Meteor.users.attachSchema(Schema.User);
Meteor.users.deny({
update: function(userId, post, fieldNames) {
if(isAdminById(userId))
return false;
// deny the update if it contains something other than the profile field
return (_.without(fieldNames, 'profile').length > 0);
}
});
Meteor.users.allow({
update: function(userId, doc){
return isAdminById(userId) || userId == doc._id;

View file

@ -71,9 +71,8 @@ getPostCommentUrl = function(postId, commentId){
};
slugify = function(text) {
if(text){
text = text.replace(/[^-a-zA-Z0-9,&\s]+/ig, '');
text = text.replace(/-/gi, "_");
text = text.replace(/\s/gi, "-");
text = text.replace(/[^-_a-zA-Z0-9,&\s]+/ig, '');
text = text.replace(/\s/gi, "+");
text = text.toLowerCase();
}
return text;

View file

@ -1,13 +1,25 @@
privacyOptions = { // false means private
secret_id: false,
isAdmin: false,
emails: false,
notifications: false,
inviteCount: false,
'profile.email': false,
'services.twitter.accessToken': false,
'services.twitter.accessTokenSecret': false,
'services.twitter.id': false,
'services.password': false,
'services.resume': false
};
privacyOptions = { // true means exposed
_id: true,
commentCount: true,
createdAt: true,
email_hash: true,
isInvited: true,
karma: true,
postCount: true,
slug: true,
username: true,
'profile.name': true,
'profile.notifications': true,
'profile.bio': true,
'profile.github': true,
'profile.site': true,
'profile.twitter': true,
'services.twitter.profile_image_url': true,
'services.facebook.id': true,
'services.twitter.screenName': true,
'services.github.screenName': true, // Github is not really used, but there are some mentions to it in the code
'votes.downvotedComments': true,
'votes.downvotedPosts': true,
'votes.upvotedComments': true,
'votes.upvotedPosts': true,
};

View file

@ -46,6 +46,7 @@ Package.onUse(function (api) {
], ['server']);
api.export([
'Notifications',
'createNotification',
'buildSiteNotification',
'newPostNotification',

View file

@ -466,12 +466,13 @@ a {
.markdown pre {
padding: 20px;
border: 1px solid #ddd;
background-color: #f8f8f8; }
/* line 68, ../scss/global/_markdown.scss */
background-color: #f8f8f8;
overflow-x: scroll; }
/* line 69, ../scss/global/_markdown.scss */
.markdown pre code {
border: none;
background: none; }
/* line 73, ../scss/global/_markdown.scss */
/* line 74, ../scss/global/_markdown.scss */
.markdown blockquote {
border-left: 3px solid #eee;
padding-left: 20px; }

View file

@ -65,6 +65,7 @@
padding: 20px;
border: 1px solid #ddd;
background-color: #f8f8f8;
overflow-x: scroll;
code{
border: none;
background: none;

View file

@ -3,9 +3,7 @@
Meteor.publish('allUsers', function(filterBy, sortBy, limit) {
if(isAdminById(this.userId)){
var parameters = getUsersParameters(filterBy, sortBy, limit);
if (!isAdminById(this.userId)) // if user is not admin, filter out sensitive info
parameters.options = _.extend(parameters.options, {fields: privacyOptions});
return Meteor.users.find(parameters.find, parameters.options);
}
return [];
});
});