Browse Source

Merge pull request #7917 from nocodb/nc-option-to-block-users

Nc option to block users
pull/7922/head
Pranav C 8 months ago committed by GitHub
parent
commit
8318fcadd8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 4
      packages/nocodb/src/meta/migrations/XcMigrationSourcev2.ts
  2. 18
      packages/nocodb/src/meta/migrations/v2/nc_042_user_block.ts
  3. 3
      packages/nocodb/src/models/User.ts

4
packages/nocodb/src/meta/migrations/XcMigrationSourcev2.ts

@ -28,6 +28,7 @@ import * as nc_038_formula_parsed_tree_column from '~/meta/migrations/v2/nc_038_
import * as nc_039_sqlite_alter_column_types from '~/meta/migrations/v2/nc_039_sqlite_alter_column_types';
import * as nc_040_form_view_alter_column_types from '~/meta/migrations/v2/nc_040_form_view_alter_column_types';
import * as nc_041_calendar_view from '~/meta/migrations/v2/nc_041_calendar_view';
import * as nc_042_user_block from '~/meta/migrations/v2/nc_042_user_block';
// Create a custom migration source class
export default class XcMigrationSourcev2 {
@ -67,6 +68,7 @@ export default class XcMigrationSourcev2 {
'nc_039_sqlite_alter_column_types',
'nc_040_form_view_alter_column_types',
'nc_041_calendar_view',
'nc_042_user_block',
]);
}
@ -136,6 +138,8 @@ export default class XcMigrationSourcev2 {
return nc_040_form_view_alter_column_types;
case 'nc_041_calendar_view':
return nc_041_calendar_view;
case 'nc_042_user_block':
return nc_042_user_block;
}
}
}

18
packages/nocodb/src/meta/migrations/v2/nc_042_user_block.ts

@ -0,0 +1,18 @@
import type { Knex } from 'knex';
import { MetaTable } from '~/utils/globals';
const up = async (knex: Knex) => {
await knex.schema.alterTable(MetaTable.USERS, (table) => {
table.boolean('blocked').defaultTo(false);
table.string('blocked_reason');
});
};
const down = async (knex: Knex) => {
await knex.schema.alterTable(MetaTable.USERS, (table) => {
table.dropColumn('blocked');
table.dropColumn('blocked_reason');
});
};
export { up, down };

3
packages/nocodb/src/models/User.ts

@ -33,6 +33,9 @@ export default class User implements UserType {
display_name?: string;
avatar?: string;
blocked?: boolean;
blocked_reason?: string;
constructor(data: User) {
Object.assign(this, data);
}

Loading…
Cancel
Save