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

[IMPROVE] Add default permission 'start-discussion' and 'start-discussion-other-user' to app user #22577

Merged
merged 7 commits into from
Aug 23, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions app/discussion/server/permissions.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import { Permissions } from '../../models';
Meteor.startup(() => {
// Add permissions for discussion
const permissions = [
{ _id: 'start-discussion', roles: ['admin', 'user', 'guest'] },
{ _id: 'start-discussion-other-user', roles: ['admin', 'user', 'owner'] },
{ _id: 'start-discussion', roles: ['admin', 'user', 'guest', 'app'] },
{ _id: 'start-discussion-other-user', roles: ['admin', 'user', 'owner', 'app'] },
];

for (const permission of permissions) {
Expand Down
8 changes: 8 additions & 0 deletions app/migrations/server/migrations.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
export declare const Migrations: {
add(migration: {
version: number;
name?: string;
up: () => void;
down?: () => void;
}): void;
};
1 change: 1 addition & 0 deletions server/startup/migrations/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -226,4 +226,5 @@ import './v226';
import './v227';
import './v228';
import './v229';
import './v230';
import './xrun';
12 changes: 12 additions & 0 deletions server/startup/migrations/v230.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { Migrations } from '../../../app/migrations/server';
import { Permissions } from '../../../app/models/server';

const roleName = 'app';

Migrations.add({
version: 230,
up() {
Permissions.update({ _id: 'start-discussion' }, { $addToSet: { roles: roleName } });
Permissions.update({ _id: 'start-discussion-other-user' }, { $addToSet: { roles: roleName } });
},
});