Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Depackaging #13483

Merged
merged 35 commits into from
Feb 14, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
171754e
Remove some dependencies inside rocketchat-lib/client (#13210)
MarcosSpessatto Jan 21, 2019
f536345
Remove some dependencies inside rocketchat-lib/lib (#13212)
MarcosSpessatto Jan 21, 2019
118634c
Remove some dependencies inside rocketchat-lib/server/functions (#13214)
MarcosSpessatto Jan 22, 2019
2bf63fb
Remove some dependencies inside rocketchat-lib/server/lib (#13217)
MarcosSpessatto Jan 22, 2019
3f1451f
Remove some dependencies inside rocketchat-lib/server/methods (#13218)
MarcosSpessatto Jan 22, 2019
23388c4
Remove some dependencies inside rocketchat-lib/server/startup, public…
MarcosSpessatto Jan 22, 2019
23547e9
Remove duplicated server settings (#13223)
MarcosSpessatto Jan 22, 2019
45b5dd0
Export functions and lib function of rc-lib but keep it inside RC na…
MarcosSpessatto Jan 23, 2019
a233ad7
Import variables from functions and lib to remove RC namespace depen…
MarcosSpessatto Jan 23, 2019
96f6fa1
Remove dependency of RC namespace in rc-sandstorm (#13227)
MarcosSpessatto Jan 23, 2019
4a3c69a
Remove dependency of RC namespace in chatpal-search (#13231)
MarcosSpessatto Jan 23, 2019
54b152f
Remove dependency of RC namespace in meteor saml (#13233)
MarcosSpessatto Jan 23, 2019
b3906fa
Remove dependency of RC namespace in rc-theme (#13234)
MarcosSpessatto Jan 23, 2019
9bd766a
Remove dependency of RC namespace in rc-2fa (#13235)
MarcosSpessatto Jan 23, 2019
86ae7c8
Remove dependency of RC namespace in rc-action-links (#13236)
MarcosSpessatto Jan 23, 2019
ed81de8
Remove dependency of RC namespace in rc-analytics and rc-assets (#13…
MarcosSpessatto Jan 24, 2019
a5e4f43
Remove dependency of RC namespace in rc-markdown, rc-autolinker and …
MarcosSpessatto Jan 24, 2019
258d258
Remove dependency of RC namespace in rc-blockstack, bot-helpers and …
MarcosSpessatto Jan 24, 2019
b9e1538
Remove dependency of RC namespace in rc-channel-settings (#13251)
MarcosSpessatto Jan 24, 2019
aff4cfe
Remove dependency of RC namespace in rc-channel-mail-messages and cl…
MarcosSpessatto Jan 24, 2019
02436be
Remove dependency of RC namespace in rc-colors, cors, crowd and dolp…
MarcosSpessatto Jan 24, 2019
5528c0f
Remove dependency of RC namespace in rc-emoji-custom and drupal (#13…
MarcosSpessatto Jan 25, 2019
c70a809
Remove dependency of RC namespace in rc-emojione, error-handler, gh-e…
MarcosSpessatto Jan 25, 2019
ffa0945
Remove dependency of RC namespace in rc-google-natural-language, gran…
MarcosSpessatto Jan 25, 2019
9ea6306
Remove dependency of RC namespace in rc-iframe-login and all imports…
MarcosSpessatto Jan 25, 2019
bff0955
Merge branch 'develop' into depackaging
MarcosSpessatto Feb 4, 2019
767f35d
Remove dependency of RC namespace in rc-api/helpers and api.js (#13273)
MarcosSpessatto Feb 6, 2019
5228d2f
Remove dependency of RC namespace on half of api files (#13275)
MarcosSpessatto Feb 6, 2019
db160bf
Partial Remove dependency of RC namespace in rc-api (#13277)
MarcosSpessatto Feb 6, 2019
c977598
Remove dependency of RC namespace in rc-api (#13278)
MarcosSpessatto Feb 6, 2019
599f6f3
Remove dependency of RC namespace in rc-graphql (#13279)
MarcosSpessatto Feb 6, 2019
05bb4a6
Remove dependency of RC namespace in rc-importer (#13280)
MarcosSpessatto Feb 6, 2019
dc75e7d
Remove dependency of RC namespace in rc-ldap, katex and issue-links …
MarcosSpessatto Feb 6, 2019
412eb06
Remove dependency of RC namespace in rc-livestream and rc-mail-messa…
MarcosSpessatto Feb 6, 2019
da35a0b
Merge branch 'develop' into depackaging
MarcosSpessatto Feb 14, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
7 changes: 4 additions & 3 deletions packages/chatpal-search/client/template/admin.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ import { Meteor } from 'meteor/meteor';
import { ReactiveVar } from 'meteor/reactive-var';
import { Template } from 'meteor/templating';
import { TAPi18n } from 'meteor/tap:i18n';
import { RocketChat } from 'meteor/rocketchat:lib';
import { settings } from 'meteor/rocketchat:settings';
import { hasRole } from 'meteor/rocketchat:authorization';
import toastr from 'toastr';

Template.ChatpalAdmin.onCreated(function() {
Expand All @@ -13,7 +14,7 @@ Template.ChatpalAdmin.onCreated(function() {

this.apiKey = new ReactiveVar();

const lang = RocketChat.settings.get('Language');
const lang = settings.get('Language');

this.lang = (lang === 'de' || lang === 'en') ? lang : 'en';

Expand Down Expand Up @@ -58,7 +59,7 @@ Template.ChatpalAdmin.helpers({
return Template.instance().apiKey.get();
},
isAdmin() {
return RocketChat.authz.hasRole(Meteor.userId(), 'admin');
return hasRole(Meteor.userId(), 'admin');
},
tac() {
return Template.instance().tac.get();
Expand Down
17 changes: 9 additions & 8 deletions packages/chatpal-search/client/template/result.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ import { ReactiveVar } from 'meteor/reactive-var';
import { Session } from 'meteor/session';
import { Template } from 'meteor/templating';
import { TAPi18n } from 'meteor/tap:i18n';
import { RocketChat } from 'meteor/rocketchat:lib';
import { roomTypes } from 'meteor/rocketchat:utils';
import { Subscriptions } from 'meteor/rocketchat:models';

Template.ChatpalSearchResultTemplate.onCreated(function() {
this.badRequest = new ReactiveVar(false);
Expand Down Expand Up @@ -91,17 +92,17 @@ Template.ChatpalSearchSingleMessage.helpers({
if (room && room.t === 'd') {
return 'at';
}
return RocketChat.roomTypes.getIcon(room && room.t);
return roomTypes.getIcon(room && room.t);
},

roomLink() {
const subscription = RocketChat.models.Subscriptions.findOne({ rid: this.rid });
return RocketChat.roomTypes.getRouteLink(subscription.t, subscription);
const subscription = Subscriptions.findOne({ rid: this.rid });
return roomTypes.getRouteLink(subscription.t, subscription);
},

roomName() {
const room = Session.get(`roomData${ this.rid }`);
return RocketChat.roomTypes.getRoomName(room.t, room);
return roomTypes.getRoomName(room.t, room);
},

time() {
Expand All @@ -118,11 +119,11 @@ Template.ChatpalSearchSingleRoom.helpers({
if (room && room.t === 'd') {
return 'at';
}
return RocketChat.roomTypes.getIcon(room && room.t);
return roomTypes.getIcon(room && room.t);
},
roomLink() {
const subscription = RocketChat.models.Subscriptions.findOne({ rid: this._id });
return RocketChat.roomTypes.getRouteLink(subscription.t, subscription);
const subscription = Subscriptions.findOne({ rid: this._id });
return roomTypes.getRouteLink(subscription.t, subscription);
},
});

Expand Down
3 changes: 3 additions & 0 deletions packages/chatpal-search/package.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ Package.onUse(function(api) {
'ecmascript',
'templating',
'rocketchat:utils',
'rocketchat:settings',
'rocketchat:models',
'rocketchat:authorization',
]);
api.addAssets([
'server/asset/chatpal-enter.svg',
Expand Down
4 changes: 2 additions & 2 deletions packages/chatpal-search/server/provider/provider.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Meteor } from 'meteor/meteor';
import { searchProviderService, SearchProvider } from 'meteor/rocketchat:search';
import Index from './index';
import ChatpalLogger from '../utils/logger';
import { RocketChat } from 'meteor/rocketchat:lib';
import { Subscriptions } from 'meteor/rocketchat:models';

/**
* The chatpal search provider enables chatpal search. An appropriate backedn has to be specified by settings.
Expand Down Expand Up @@ -301,7 +301,7 @@ class ChatpalProvider extends SearchProvider {
* @private
*/
_getAcl(context) {
return RocketChat.models.Subscriptions.find({ 'u._id': context.uid }).fetch().map((room) => room.rid);
return Subscriptions.find({ 'u._id': context.uid }).fetch().map((room) => room.rid);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion packages/meteor-accounts-saml/package.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ Package.on_use(function(api) {
'routepolicy',
'webapp',
'rocketchat:lib',
'rocketchat:models',
'service-configuration',
], 'server');

api.mainModule('client/index.js', 'client');
api.mainModule('server/index.js', 'server');
});
62 changes: 31 additions & 31 deletions packages/meteor-accounts-saml/server/saml_rocketchat.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { Meteor } from 'meteor/meteor';
import { Accounts } from 'meteor/accounts-base';
import { RocketChat } from 'meteor/rocketchat:lib';
import { Logger } from 'meteor/rocketchat:logger';
import { ServiceConfiguration } from 'meteor/service-configuration';
import { settings } from 'meteor/rocketchat:settings';

const logger = new Logger('steffo:meteor-accounts-saml', {
methods: {
Expand All @@ -12,92 +12,92 @@ const logger = new Logger('steffo:meteor-accounts-saml', {
},
});

RocketChat.settings.addGroup('SAML');
settings.addGroup('SAML');

Meteor.methods({
addSamlService(name) {
RocketChat.settings.add(`SAML_Custom_${ name }`, false, {
settings.add(`SAML_Custom_${ name }`, false, {
type: 'boolean',
group: 'SAML',
section: name,
i18nLabel: 'Accounts_OAuth_Custom_Enable',
});
RocketChat.settings.add(`SAML_Custom_${ name }_provider`, 'provider-name', {
settings.add(`SAML_Custom_${ name }_provider`, 'provider-name', {
type: 'string',
group: 'SAML',
section: name,
i18nLabel: 'SAML_Custom_Provider',
});
RocketChat.settings.add(`SAML_Custom_${ name }_entry_point`, 'https://example.com/simplesaml/saml2/idp/SSOService.php', {
settings.add(`SAML_Custom_${ name }_entry_point`, 'https://example.com/simplesaml/saml2/idp/SSOService.php', {
type: 'string',
group: 'SAML',
section: name,
i18nLabel: 'SAML_Custom_Entry_point',
});
RocketChat.settings.add(`SAML_Custom_${ name }_idp_slo_redirect_url`, 'https://example.com/simplesaml/saml2/idp/SingleLogoutService.php', {
settings.add(`SAML_Custom_${ name }_idp_slo_redirect_url`, 'https://example.com/simplesaml/saml2/idp/SingleLogoutService.php', {
type: 'string',
group: 'SAML',
section: name,
i18nLabel: 'SAML_Custom_IDP_SLO_Redirect_URL',
});
RocketChat.settings.add(`SAML_Custom_${ name }_issuer`, 'https://your-rocket-chat/_saml/metadata/provider-name', {
settings.add(`SAML_Custom_${ name }_issuer`, 'https://your-rocket-chat/_saml/metadata/provider-name', {
type: 'string',
group: 'SAML',
section: name,
i18nLabel: 'SAML_Custom_Issuer',
});
RocketChat.settings.add(`SAML_Custom_${ name }_cert`, '', {
settings.add(`SAML_Custom_${ name }_cert`, '', {
type: 'string',
group: 'SAML',
section: name,
i18nLabel: 'SAML_Custom_Cert',
multiline: true,
});
RocketChat.settings.add(`SAML_Custom_${ name }_public_cert`, '', {
settings.add(`SAML_Custom_${ name }_public_cert`, '', {
type: 'string',
group: 'SAML',
section: name,
multiline: true,
i18nLabel: 'SAML_Custom_Public_Cert',
});
RocketChat.settings.add(`SAML_Custom_${ name }_private_key`, '', {
settings.add(`SAML_Custom_${ name }_private_key`, '', {
type: 'string',
group: 'SAML',
section: name,
multiline: true,
i18nLabel: 'SAML_Custom_Private_Key',
});
RocketChat.settings.add(`SAML_Custom_${ name }_button_label_text`, '', {
settings.add(`SAML_Custom_${ name }_button_label_text`, '', {
type: 'string',
group: 'SAML',
section: name,
i18nLabel: 'Accounts_OAuth_Custom_Button_Label_Text',
});
RocketChat.settings.add(`SAML_Custom_${ name }_button_label_color`, '#FFFFFF', {
settings.add(`SAML_Custom_${ name }_button_label_color`, '#FFFFFF', {
type: 'string',
group: 'SAML',
section: name,
i18nLabel: 'Accounts_OAuth_Custom_Button_Label_Color',
});
RocketChat.settings.add(`SAML_Custom_${ name }_button_color`, '#13679A', {
settings.add(`SAML_Custom_${ name }_button_color`, '#13679A', {
type: 'string',
group: 'SAML',
section: name,
i18nLabel: 'Accounts_OAuth_Custom_Button_Color',
});
RocketChat.settings.add(`SAML_Custom_${ name }_generate_username`, false, {
settings.add(`SAML_Custom_${ name }_generate_username`, false, {
type: 'boolean',
group: 'SAML',
section: name,
i18nLabel: 'SAML_Custom_Generate_Username',
});
RocketChat.settings.add(`SAML_Custom_${ name }_debug`, false, {
settings.add(`SAML_Custom_${ name }_debug`, false, {
type: 'boolean',
group: 'SAML',
section: name,
i18nLabel: 'SAML_Custom_Debug',
});
RocketChat.settings.add(`SAML_Custom_${ name }_logout_behaviour`, 'SAML', {
settings.add(`SAML_Custom_${ name }_logout_behaviour`, 'SAML', {
type: 'select',
values: [
{ key: 'SAML', i18nLabel: 'SAML_Custom_Logout_Behaviour_Terminate_SAML_Session' },
Expand All @@ -112,22 +112,22 @@ Meteor.methods({

const getSamlConfigs = function(service) {
return {
buttonLabelText: RocketChat.settings.get(`${ service.key }_button_label_text`),
buttonLabelColor: RocketChat.settings.get(`${ service.key }_button_label_color`),
buttonColor: RocketChat.settings.get(`${ service.key }_button_color`),
buttonLabelText: settings.get(`${ service.key }_button_label_text`),
buttonLabelColor: settings.get(`${ service.key }_button_label_color`),
buttonColor: settings.get(`${ service.key }_button_color`),
clientConfig: {
provider: RocketChat.settings.get(`${ service.key }_provider`),
provider: settings.get(`${ service.key }_provider`),
},
entryPoint: RocketChat.settings.get(`${ service.key }_entry_point`),
idpSLORedirectURL: RocketChat.settings.get(`${ service.key }_idp_slo_redirect_url`),
generateUsername: RocketChat.settings.get(`${ service.key }_generate_username`),
debug: RocketChat.settings.get(`${ service.key }_debug`),
issuer: RocketChat.settings.get(`${ service.key }_issuer`),
logoutBehaviour: RocketChat.settings.get(`${ service.key }_logout_behaviour`),
entryPoint: settings.get(`${ service.key }_entry_point`),
idpSLORedirectURL: settings.get(`${ service.key }_idp_slo_redirect_url`),
generateUsername: settings.get(`${ service.key }_generate_username`),
debug: settings.get(`${ service.key }_debug`),
issuer: settings.get(`${ service.key }_issuer`),
logoutBehaviour: settings.get(`${ service.key }_logout_behaviour`),
secret: {
privateKey: RocketChat.settings.get(`${ service.key }_private_key`),
publicCert: RocketChat.settings.get(`${ service.key }_public_cert`),
cert: RocketChat.settings.get(`${ service.key }_cert`),
privateKey: settings.get(`${ service.key }_private_key`),
publicCert: settings.get(`${ service.key }_public_cert`),
cert: settings.get(`${ service.key }_cert`),
},
};
};
Expand Down Expand Up @@ -168,7 +168,7 @@ const configureSamlService = function(samlConfigs) {
};

const updateServices = debounce(() => {
const services = RocketChat.settings.get(/^(SAML_Custom_)[a-z]+$/i);
const services = settings.get(/^(SAML_Custom_)[a-z]+$/i);
Accounts.saml.settings.providers = services.map((service) => {
if (service.value === true) {
const samlConfigs = getSamlConfigs(service);
Expand All @@ -187,7 +187,7 @@ const updateServices = debounce(() => {
}, 2000);


RocketChat.settings.get(/^SAML_.+/, updateServices);
settings.get(/^SAML_.+/, updateServices);

Meteor.startup(() => Meteor.call('addSamlService', 'Default'));

Expand Down
11 changes: 6 additions & 5 deletions packages/meteor-accounts-saml/server/saml_server.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@ import { Meteor } from 'meteor/meteor';
import { Accounts } from 'meteor/accounts-base';
import { Random } from 'meteor/random';
import { WebApp } from 'meteor/webapp';
import { RocketChat } from 'meteor/rocketchat:lib';
import { RoutePolicy } from 'meteor/routepolicy';
import { CredentialTokens } from 'meteor/rocketchat:models';
import { generateUsernameSuggestion } from 'meteor/rocketchat:lib';
import bodyParser from 'body-parser';
import { SAML } from './saml_utils';
import _ from 'underscore';
Expand Down Expand Up @@ -126,7 +127,7 @@ Accounts.registerLoginHandler(function(loginRequest) {
};

if (Accounts.saml.settings.generateUsername === true) {
const username = RocketChat.generateUsernameSuggestion(newUser);
const username = generateUsernameSuggestion(newUser);
if (username) {
newUser.username = username;
}
Expand Down Expand Up @@ -176,19 +177,19 @@ Accounts.registerLoginHandler(function(loginRequest) {
});

Accounts.saml.hasCredential = function(credentialToken) {
return RocketChat.models.CredentialTokens.findOneById(credentialToken) != null;
return CredentialTokens.findOneById(credentialToken) != null;
};

Accounts.saml.retrieveCredential = function(credentialToken) {
// The credentialToken in all these functions corresponds to SAMLs inResponseTo field and is mandatory to check.
const data = RocketChat.models.CredentialTokens.findOneById(credentialToken);
const data = CredentialTokens.findOneById(credentialToken);
if (data) {
return data.userInfo;
}
};

Accounts.saml.storeCredential = function(credentialToken, loginResult) {
RocketChat.models.CredentialTokens.create(credentialToken, loginResult);
CredentialTokens.create(credentialToken, loginResult);
};

const closePopup = function(res, err) {
Expand Down
2 changes: 1 addition & 1 deletion packages/rocketchat-2fa/client/TOTPPassword.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Meteor } from 'meteor/meteor';
import { Accounts } from 'meteor/accounts-base';
import { modal } from 'meteor/rocketchat:ui';
import { modal } from 'meteor/rocketchat:ui-utils';
import { t } from 'meteor/rocketchat:utils';
import toastr from 'toastr';

Expand Down
6 changes: 3 additions & 3 deletions packages/rocketchat-2fa/client/accountSecurity.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { Meteor } from 'meteor/meteor';
import { ReactiveVar } from 'meteor/reactive-var';
import { Template } from 'meteor/templating';
import { modal } from 'meteor/rocketchat:ui';
import { RocketChat } from 'meteor/rocketchat:lib';
import { modal } from 'meteor/rocketchat:ui-utils';
import { settings } from 'meteor/rocketchat:settings';
import { t } from 'meteor/rocketchat:utils';
import toastr from 'toastr';
import qrcode from 'yaqrcode';
Expand All @@ -27,7 +27,7 @@ Template.accountSecurity.helpers({
return Template.instance().state.get() === 'registering';
},
isAllowed() {
return RocketChat.settings.get('Accounts_TwoFactorAuthentication_Enabled');
return settings.get('Accounts_TwoFactorAuthentication_Enabled');
},
codesRemaining() {
if (Template.instance().codesRemaining.get()) {
Expand Down
6 changes: 4 additions & 2 deletions packages/rocketchat-2fa/package.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,13 @@ Package.onUse(function(api) {
'accounts-base',
'ecmascript',
'templating',
'rocketchat:lib',
'rocketchat:settings',
'sha',
'random',
'rocketchat:ui',
'rocketchat:ui-utils',
'rocketchat:utils',
'rocketchat:models',
'rocketchat:callbacks',
]);

api.mainModule('client/index.js', 'client');
Expand Down
2 changes: 0 additions & 2 deletions packages/rocketchat-2fa/server/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
import './startup/settings';
import './lib/totp';
import './models/users';
import './methods/checkCodesRemaining';
import './methods/disable';
import './methods/enable';
Expand Down
Loading