Skip to content

Commit

Permalink
Merge branch 'admin-refactor' of github.com:RocketChat/Rocket.Chat in…
Browse files Browse the repository at this point in the history
…to integrations

* 'admin-refactor' of github.com:RocketChat/Rocket.Chat:
  fix all paddings and mixed content between screens (#17538)
  [IMPROVE] Add new webhooks to the Omnichannel integration feature (#17503)
  [BREAK] Remove deprecated Omnichannel Knowledge Base feature (#17387)
  [FIX] Reactions may present empty names of who reacted when using Real Names (#17536)
  [IMPROVE] Custom sounds refactor (#17485)
  Allow to filter omnichannel analytics dashboards per departments. (#17463)
  [FIX] Uncessary updates on Settings, Roles and Permissions on startup (#17160)
  [NEW] Add the ability to send Livechat offline messages to a channel (#17442)
  [FIX] Federation attachment URL for audio and video files (#16430)
  [NEW] Add Livechat website URL to the offline message e-mail (#17429)
  • Loading branch information
gabriellsh committed May 5, 2020
2 parents 0fd63c5 + e009ec8 commit d03803d
Show file tree
Hide file tree
Showing 129 changed files with 2,945 additions and 2,288 deletions.
2 changes: 1 addition & 1 deletion app/api/server/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,7 @@ export class APIClass extends Restivus {
'error-unauthorized': 'unauthorized',
}[e.error] || 'failure';

result = API.v1[apiMethod](typeof e === 'string' ? e : e.message, e.error, undefined, e);
result = API.v1[apiMethod](typeof e === 'string' ? e : e.message, e.error, process.env.TEST_MODE ? e.stack : undefined, e);
} finally {
delete Accounts._accountData[connection.id];
}
Expand Down
2 changes: 1 addition & 1 deletion app/api/server/v1/chat.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { Match, check } from 'meteor/check';
import { Messages } from '../../../models';
import { canAccessRoom, hasPermission } from '../../../authorization';
import { normalizeMessagesForUser } from '../../../utils/server/lib/normalizeMessagesForUser';
import { processWebhookMessage } from '../../../lib';
import { processWebhookMessage } from '../../../lib/server';
import { API } from '../api';
import Rooms from '../../../models/server/models/Rooms';
import Users from '../../../models/server/models/Users';
Expand Down
2 changes: 1 addition & 1 deletion app/api/server/v1/permissions.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Meteor } from 'meteor/meteor';
import { Match, check } from 'meteor/check';

import { hasPermission } from '../../../authorization';
import { Permissions, Roles } from '../../../models';
import { Permissions, Roles } from '../../../models/server';
import { API } from '../api';

/**
Expand Down
2 changes: 1 addition & 1 deletion app/api/server/v1/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { Match, check } from 'meteor/check';
import { ServiceConfiguration } from 'meteor/service-configuration';
import _ from 'underscore';

import { Settings } from '../../../models';
import { Settings } from '../../../models/server';
import { hasPermission } from '../../../authorization';
import { API } from '../api';

Expand Down
2 changes: 1 addition & 1 deletion app/apps/server/orchestrator.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class AppServerOrchestrator {

initialize() {
this._rocketchatLogger = new Logger('Rocket.Chat Apps');
Permissions.createOrUpdate('manage-apps', ['admin']);
Permissions.create('manage-apps', ['admin']);

this._marketplaceUrl = 'https://marketplace.rocket.chat';

Expand Down
23 changes: 14 additions & 9 deletions app/authorization/server/startup.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* eslint no-multi-spaces: 0 */
import { Meteor } from 'meteor/meteor';

import { Roles, Permissions, Settings } from '../../models';
import { Roles, Permissions, Settings } from '../../models/server';
import { settings } from '../../settings/server';
import { getSettingPermissionId, CONSTANTS } from '../lib';
import { clearCache } from './functions/hasPermission';
Expand Down Expand Up @@ -114,9 +114,7 @@ Meteor.startup(function() {
];

for (const permission of permissions) {
if (!Permissions.findOneById(permission._id)) {
Permissions.upsert(permission._id, { $set: permission });
}
Permissions.create(permission._id, permission.roles);
}

const defaultRoles = [
Expand All @@ -134,7 +132,7 @@ Meteor.startup(function() {
];

for (const role of defaultRoles) {
Roles.upsert({ _id: role.name }, { $setOnInsert: { scope: role.scope, description: role.description || '', protected: true, mandatory2fa: false } });
Roles.createOrUpdate(role.name, role.scope, role.description, true, false);
}

const getPreviousPermissions = function(settingId) {
Expand All @@ -155,27 +153,34 @@ Meteor.startup(function() {
const createSettingPermission = function(setting, previousSettingPermissions) {
const permissionId = getSettingPermissionId(setting._id);
const permission = {
_id: permissionId,
level: CONSTANTS.SETTINGS_LEVEL,
// copy those setting-properties which are needed to properly publish the setting-based permissions
settingId: setting._id,
group: setting.group,
section: setting.section,
sorter: setting.sorter,
roles: [],
};
// copy previously assigned roles if available
if (previousSettingPermissions[permissionId] && previousSettingPermissions[permissionId].roles) {
permission.roles = previousSettingPermissions[permissionId].roles;
} else {
permission.roles = [];
}
if (setting.group) {
permission.groupPermissionId = getSettingPermissionId(setting.group);
}
if (setting.section) {
permission.sectionPermissionId = getSettingPermissionId(setting.section);
}
Permissions.upsert(permission._id, { $set: permission });

const existent = Permissions.findOne({
_id: permissionId,
...permission,
}, { fields: { _id: 1 } });

if (!existent) {
Permissions.upsert({ _id: permissionId }, { $set: permission });
}

delete previousSettingPermissions[permissionId];
};

Expand Down
4 changes: 1 addition & 3 deletions app/channel-settings-mail-messages/server/lib/startup.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,5 @@ Meteor.startup(function() {
_id: 'mail-messages',
roles: ['admin'],
};
return Permissions.upsert(permission._id, {
$setOnInsert: permission,
});
return Permissions.create(permission._id, permission.roles);
});
6 changes: 3 additions & 3 deletions app/channel-settings/server/startup.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { Meteor } from 'meteor/meteor';
import { Permissions } from '../../models';

Meteor.startup(function() {
Permissions.upsert('post-readonly', { $setOnInsert: { roles: ['admin', 'owner', 'moderator'] } });
Permissions.upsert('set-readonly', { $setOnInsert: { roles: ['admin', 'owner'] } });
Permissions.upsert('set-react-when-readonly', { $setOnInsert: { roles: ['admin', 'owner'] } });
Permissions.create('post-readonly', ['admin', 'owner', 'moderator']);
Permissions.create('set-readonly', ['admin', 'owner']);
Permissions.create('set-react-when-readonly', ['admin', 'owner']);
});
2 changes: 1 addition & 1 deletion app/cloud/server/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { Permissions } from '../../models';
import { settings } from '../../settings/server';

if (Permissions) {
Permissions.createOrUpdate('manage-cloud', ['admin']);
Permissions.create('manage-cloud', ['admin']);
}

const licenseCronName = 'Cloud Workspace Sync';
Expand Down
111 changes: 0 additions & 111 deletions app/custom-sounds/assets/stylesheets/customSoundsAdmin.css

This file was deleted.

7 changes: 0 additions & 7 deletions app/custom-sounds/client/admin/adminSoundEdit.html

This file was deleted.

7 changes: 0 additions & 7 deletions app/custom-sounds/client/admin/adminSoundInfo.html

This file was deleted.

78 changes: 0 additions & 78 deletions app/custom-sounds/client/admin/adminSounds.html

This file was deleted.

Loading

0 comments on commit d03803d

Please sign in to comment.