Mm 63935 abac end user indicators db isolated changes (#8860)
* MM-63935 - abac end user indicators db changes
This commit is contained in:
parent
934ed2a773
commit
84a1520698
7 changed files with 24 additions and 3 deletions
|
|
@ -11,6 +11,17 @@ import {MM_TABLES} from '@constants/database';
|
|||
const {CHANNEL_BOOKMARK, CHANNEL_INFO, DRAFT, FILE, POST, CHANNEL, CUSTOM_PROFILE_ATTRIBUTE, CUSTOM_PROFILE_FIELD, SCHEDULED_POST} = MM_TABLES.SERVER;
|
||||
|
||||
export default schemaMigrations({migrations: [
|
||||
{
|
||||
toVersion: 11,
|
||||
steps: [
|
||||
addColumns({
|
||||
table: CHANNEL,
|
||||
columns: [
|
||||
{name: 'abac_policy_enforced', type: 'boolean', isOptional: true},
|
||||
],
|
||||
}),
|
||||
],
|
||||
},
|
||||
{
|
||||
toVersion: 10,
|
||||
steps: [
|
||||
|
|
|
|||
|
|
@ -112,6 +112,9 @@ export default class ChannelModel extends Model implements ChannelModelInterface
|
|||
/** bannerInfo : The banner information for the channel */
|
||||
@json('banner_info', safeParseJSON) bannerInfo?: ChannelBannerInfo;
|
||||
|
||||
/** policy_enforced : Whether the Attribute-Based Access Control (ABAC) policy is enforced for this channel, controlling access based on user attributes */
|
||||
@field('abac_policy_enforced') abacPolicyEnforced?: boolean;
|
||||
|
||||
/** members : Users belonging to this channel */
|
||||
@children(CHANNEL_MEMBERSHIP) members!: Query<ChannelMembershipModel>;
|
||||
|
||||
|
|
@ -163,6 +166,7 @@ export default class ChannelModel extends Model implements ChannelModelInterface
|
|||
group_constrained: null,
|
||||
shared: this.shared,
|
||||
banner_info: this.bannerInfo,
|
||||
policy_enforced: this.abacPolicyEnforced,
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -52,6 +52,7 @@ export const transformChannelRecord = ({action, database, value}: TransformerArg
|
|||
channel.teamId = raw.team_id;
|
||||
channel.type = raw.type;
|
||||
channel.bannerInfo = raw.banner_info;
|
||||
channel.abacPolicyEnforced = Boolean(raw.policy_enforced);
|
||||
};
|
||||
|
||||
return prepareBaseRecord({
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ import {
|
|||
} from './table_schemas';
|
||||
|
||||
export const serverSchema: AppSchema = appSchema({
|
||||
version: 10,
|
||||
version: 11,
|
||||
tables: [
|
||||
CategorySchema,
|
||||
CategoryChannelSchema,
|
||||
|
|
|
|||
|
|
@ -21,5 +21,6 @@ export default tableSchema({
|
|||
{name: 'type', type: 'string'},
|
||||
{name: 'update_at', type: 'number'},
|
||||
{name: 'banner_info', type: 'string', isOptional: true},
|
||||
{name: 'abac_policy_enforced', type: 'boolean', isOptional: true},
|
||||
],
|
||||
});
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ const {
|
|||
describe('*** Test schema for SERVER database ***', () => {
|
||||
it('=> The SERVER SCHEMA should strictly match', () => {
|
||||
expect(serverSchema).toEqual({
|
||||
version: 10,
|
||||
version: 11,
|
||||
unsafeSql: undefined,
|
||||
tables: {
|
||||
[CATEGORY]: {
|
||||
|
|
@ -126,7 +126,7 @@ describe('*** Test schema for SERVER database ***', () => {
|
|||
type: {name: 'type', type: 'string'},
|
||||
update_at: {name: 'update_at', type: 'number'},
|
||||
banner_info: {name: 'banner_info', type: 'string', isOptional: true},
|
||||
|
||||
abac_policy_enforced: {name: 'abac_policy_enforced', type: 'boolean', isOptional: true},
|
||||
},
|
||||
columnArray: [
|
||||
{name: 'create_at', type: 'number'},
|
||||
|
|
@ -140,6 +140,7 @@ describe('*** Test schema for SERVER database ***', () => {
|
|||
{name: 'type', type: 'string'},
|
||||
{name: 'update_at', type: 'number'},
|
||||
{name: 'banner_info', type: 'string', isOptional: true},
|
||||
{name: 'abac_policy_enforced', type: 'boolean', isOptional: true},
|
||||
],
|
||||
},
|
||||
[CHANNEL_BOOKMARK]: {
|
||||
|
|
|
|||
|
|
@ -56,6 +56,9 @@ declare class ChannelModel extends Model {
|
|||
|
||||
bannerInfo?: ChannelBannerInfo;
|
||||
|
||||
/** Whether the channel has Attribute-Based Access Control (ABAC) policy enforcement enabled, controlling access based on user attributes */
|
||||
abacPolicyEnforced?: boolean;
|
||||
|
||||
/** members : Users belonging to this channel */
|
||||
members: Query<ChannelMembershipModel>;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue