bigbluebutton-Github/bigbluebutton-html5/imports/ui/components/settings/service.js
2017-03-28 15:41:48 -03:00

37 lines
804 B
JavaScript

import Users from '/imports/api/users';
import Captions from '/imports/api/captions';
import Auth from '/imports/ui/services/auth';
import _ from 'lodash';
import Settings from '/imports/ui/services/settings';
const getClosedCaptionLocales = () => {
//list of unique locales in the Captions Collection
const locales = _.uniq(Captions.find({}, {
sort: { locale: 1 },
fields: { locale: true },
}).fetch().map(function (obj) {
return obj.locale;
}), true);
return locales;
};
const getUserRoles = () => {
const user = Users.findOne({
userId: Auth.userID,
}).user;
return user.role;
};
const updateSettings = (obj) => {
Object.keys(obj).forEach(k => Settings[k] = obj[k]);
Settings.save();
};
export {
getClosedCaptionLocales,
getUserRoles,
updateSettings,
};