Fix a few review comments

This commit is contained in:
Klaus Klein 2017-06-01 17:40:55 -03:00
parent 1db64e2bb7
commit fc73992a63
23 changed files with 46 additions and 54 deletions

View File

@ -3,9 +3,9 @@ import Users from '/imports/api/users/'
export class Acl {
constructor(aclConfig, Users) {
constructor(config, Users) {
this.Users = Users;
this.aclConfig = aclConfig;
this.config = config;
}
subscribe(channel,credentials){
@ -14,7 +14,7 @@ export class Acl {
let subscriptions = this.getSubscriptions(credentials);
if (subscriptions) {
return !!this.checkPermission(channel, subscriptions);
return this.checkPermission(channel, subscriptions);
}
return false;
}
@ -62,7 +62,7 @@ export class Acl {
if(!user){
return false;
}
return this.roleExist(this.aclConfig, user.user.role);
return this.roleExist(this.config, user.user.role);
}
checkPermission(permission, permissions) {

View File

@ -15,7 +15,7 @@ export default class SIPBridge extends BaseAudioBridge {
}
joinListenOnly() {
makeCall('listenOnlyToggle', true,Auth.credentials);
makeCall('listenOnlyToggle', true);
this._joinVoiceCallSIP({ isListenOnly: true });
}
@ -32,7 +32,7 @@ export default class SIPBridge extends BaseAudioBridge {
// notify BBB-apps we are leaving the call if we are in listen only mode
if (isListenOnly) {
makeCall('listenOnlyToggle', false, Auth.credentials);
makeCall('listenOnlyToggle', false);
}
};

View File

@ -4,8 +4,8 @@ import { Meteor } from 'meteor/meteor';
import mapToAcl from '/imports/startup/mapToAcl';
Meteor.publish('breakouts', function() {
breakouts = breakouts.bind(this);
return mapToAcl('breakouts',breakouts)(arguments);
const boundBreakouts = breakouts.bind(this);
return mapToAcl('breakouts',boundBreakouts)(arguments);
});
function breakouts(credentials) {

View File

@ -6,8 +6,8 @@ import Logger from '/imports/startup/server/logger';
import mapToAcl from '/imports/startup/mapToAcl';
Meteor.publish('captions', function() {
captions = captions.bind(this);
return mapToAcl('captions',captions)(arguments);
const boundCaptions = captions.bind(this);
return mapToAcl('captions',boundCaptions)(arguments);
});
function captions(credentials) {

View File

@ -6,8 +6,8 @@ import Logger from '/imports/startup/server/logger';
import mapToAcl from '/imports/startup/mapToAcl';
Meteor.publish('chat', function() {
chat = chat.bind(this);
return mapToAcl('chat', chat)(arguments);
const boundChat = chat.bind(this);
return mapToAcl('chat', boundChat)(arguments);
});
function chat(credentials) {

View File

@ -6,8 +6,8 @@ import Logger from '/imports/startup/server/logger';
import mapToAcl from '/imports/startup/mapToAcl';
Meteor.publish('cursor', function() {
cursor = cursor.bind(this);
return mapToAcl('cursor', cursor)(arguments);
const boundCursor = cursor.bind(this);
return mapToAcl('cursor', boundCursor)(arguments);
});
function cursor(credentials) {

View File

@ -4,8 +4,8 @@ import { logger } from '/imports/startup/server/logger';
import mapToAcl from '/imports/startup/mapToAcl';
Meteor.publish('deskshare', function() {
deskshare = deskshare.bind(this);
return mapToAcl('deskshare', deskshare)(arguments);
const boundDeskshare = deskshare.bind(this);
return mapToAcl('deskshare', boundDeskshare)(arguments);
});
function deskshare(credentials) {

View File

@ -6,8 +6,8 @@ import Logger from '/imports/startup/server/logger';
import mapToAcl from '/imports/startup/mapToAcl';
Meteor.publish('meetings', function() {
meetings = meetings.bind(this);
return mapToAcl('meetings', meetings)(arguments);
const boundMeetings = meetings.bind(this);
return mapToAcl('meetings', boundMeetings)(arguments);
});
function meetings(credentials) {

View File

@ -5,8 +5,8 @@ import { logger } from '/imports/startup/server/logger';
import mapToAcl from '/imports/startup/mapToAcl';
Meteor.publish('polls', function() {
polls = polls.bind(this);
return mapToAcl('polls', polls)(arguments);
const boundPolls = polls.bind(this);
return mapToAcl('polls', boundPolls)(arguments);
});
function polls(credentials) {

View File

@ -6,8 +6,8 @@ import Logger from '/imports/startup/server/logger';
import mapToAcl from '/imports/startup/mapToAcl';
Meteor.publish('presentations', function() {
presentations = presentations.bind(this);
return mapToAcl('presentations', presentations)(arguments);
const boundPresentations = presentations.bind(this);
return mapToAcl('presentations', boundPresentations)(arguments);
});
function presentations(credentials) {

View File

@ -6,8 +6,8 @@ import Logger from '/imports/startup/server/logger';
import mapToAcl from '/imports/startup/mapToAcl';
Meteor.publish('shapes', function() {
shapes = shapes.bind(this);
return mapToAcl('shapes', shapes)(arguments);
const boundShapes = shapes.bind(this);
return mapToAcl('shapes', boundShapes)(arguments);
});
function shapes(credentials) {

View File

@ -6,8 +6,8 @@ import mapToAcl from '/imports/startup/mapToAcl';
Meteor.publish('slides', function() {
slides = slides.bind(this);
return mapToAcl('slides', slides)(arguments);
const boundSlides = slides.bind(this);
return mapToAcl('slides', boundSlides)(arguments);
});
function slides(credentials) {

View File

@ -33,7 +33,7 @@ Meteor.publish('current-user', function (credentials) {
});
Meteor.publish('users', function () {
let boundUsers = users.bind(this);
const boundUsers = users.bind(this);
return mapToAcl('users',boundUsers)(arguments);
});

View File

@ -4,7 +4,7 @@ import { Acl } from '/imports/api/acl/Acl';
let AclSingleton = new Acl();
Meteor.startup(() => {
AclSingleton.aclConfig = Meteor.settings.public.acl;
AclSingleton.config = Meteor.settings.public.acl;
AclSingleton.Users = Users;
});

View File

@ -2,11 +2,10 @@ import Acl from '/imports/startup/acl';
import { Meteor } from 'meteor/meteor';
import Logger from '/imports/startup/server/logger';
const emptyCollection = new Mongo.Collection("emptyCollection");
const injectAclActionCheck = (name, handler) => {
return (...args) => {
const credentials = args[args.length - 1];
console.log("Arguments",...args);
const credentials = args[0];
if (!Acl.can(name, credentials)) {
throw new Meteor.Error('acl-not-allowed',
`The user can't perform the action "${name}".`);
@ -20,7 +19,7 @@ const injectAclSubscribeCheck = (name,handler) => {
const credentials = args[args.length - 1];
if (!Acl.subscribe(name, ...credentials)) {
Logger.error(`acl-not-allowed, the user can't perform the subscription "${name}".`);
return emptyCollection.find();
return [];
}
return handler(...credentials);
}

View File

@ -22,8 +22,7 @@ let getEmojiData = () => {
// Below doesn't even need to receieve credentials
const setEmoji = (toRaiseUserId, status) => {
const credentials = Auth.credentials;
makeCall('setEmojiStatus', toRaiseUserId, status,credentials);
makeCall('setEmojiStatus', toRaiseUserId, status);
};
export default {

View File

@ -24,11 +24,11 @@ export default createContainer((params) => {
let callback = () => { };
if (isInAudio && !isMuted) {
callback = () => makeCall('muteUser', userId, Auth.credentials);
callback = () => makeCall('muteUser', userId);
}
if (isInAudio && isMuted) {
callback = () => makeCall('unmuteUser', userId, Auth.credentials);
callback = () => makeCall('unmuteUser', userId);
}
const data = {

View File

@ -192,7 +192,7 @@ const sendMessage = (receiverID, message) => {
Storage.setItem(CLOSED_CHAT_LIST_KEY, _.without(currentClosedChats, receiver.id));
}
makeCall('sendChat', messagePayload, Auth.credentials);
makeCall('sendChat', messagePayload);
return messagePayload;
};

View File

@ -18,7 +18,7 @@ let mapPolls = function () {
pollExists: true,
amIRequester: amIRequester,
handleVote: function (pollId, answerId) {
makeCall('publishVote', pollId, answerId.id, Auth.credentials);
makeCall('publishVote', pollId, answerId.id);
},
};
};

View File

@ -36,19 +36,19 @@ let getSlideData = (params) => {
const previousSlide = (currentSlideNum) => {
if (currentSlideNum > 1) {
makeCall('switchSlideMessage', currentSlideNum - 1,Auth.credentials);
makeCall('switchSlideMessage', currentSlideNum - 1);
}
};
const nextSlide = (currentSlideNum, numberOfSlides) => {
if (currentSlideNum < numberOfSlides) {
makeCall('switchSlideMessage', currentSlideNum + 1,Auth.credentials);
makeCall('switchSlideMessage', currentSlideNum + 1);
}
};
const skipToSlide = (event) => {
const requestedSlideNum = parseInt(event.target.value);
makeCall('switchSlideMessage', requestedSlideNum,Auth.credentials);
makeCall('switchSlideMessage', requestedSlideNum);
};
export default {

View File

@ -252,27 +252,27 @@ class UserList extends Component {
},
clearStatus: {
label: intl.formatMessage(intlMessages.ClearStatusLabel),
handler: user => makeCall('setEmojiStatus', user.id, 'none', Auth.credentials),
handler: user => makeCall('setEmojiStatus', user.id, 'none'),
icon: 'clear_status',
},
setPresenter: {
label: intl.formatMessage(intlMessages.MakePresenterLabel),
handler: user => makeCall('assignPresenter', user.id, Auth.credentials),
handler: user => makeCall('assignPresenter', user.id),
icon: 'presentation',
},
kick: {
label: intl.formatMessage(intlMessages.KickUserLabel),
handler: user => makeCall('kickUser', user.id, Auth.credentials),
handler: user => makeCall('kickUser', user.id),
icon: 'circle_close',
},
mute: {
label: intl.formatMessage(intlMessages.MuteUserAudioLabel),
handler: user => makeCall('muteUser', user.id, Auth.credentials),
handler: user => makeCall('muteUser', user.id),
icon: 'audio_off',
},
unmute: {
label: intl.formatMessage(intlMessages.UnmuteUserAudioLabel),
handler: user => makeCall('unmuteUser', user.id, Auth.credentials),
handler: user => makeCall('unmuteUser', user.id),
icon: 'audio_on',
},
};

View File

@ -185,9 +185,8 @@ class Auth {
},
});
});
const credentials = this.credentials;
makeCall('validateAuthToken', credentials);
makeCall('validateAuthToken');
});
}

View File

@ -2,7 +2,6 @@ acl:
viewer:
subscriptions:
- 'users'
- 'chat'
- 'cursor'
- 'deskshare'
- 'meetings'
@ -18,13 +17,11 @@ acl:
- 'userLogout'
- 'assignPresenter'
- 'setEmojiStatus'
- 'validateAuthToken'
- 'muteUser'
- 'unmuteUser'
- 'switchSlide'
- 'switchSlideMessage'
- 'publishVote'
- 'logClient'
- 'sendChat'
- 'switchSlideMessage'
moderator:
@ -46,12 +43,10 @@ acl:
- 'userLogout'
- 'assignPresenter'
- 'setEmojiStatus'
- 'validateAuthToken'
- 'muteUser'
- 'unmuteUser'
- 'switchSlide'
- 'switchSlideMessage'
- 'publishVote'
- 'logClient'
- 'sendChat'
- 'switchSlideMessage'