Mm 63935 abac end user indicators db isolated changes (#8860)

* MM-63935 - abac end user indicators db changes
This commit is contained in:
Pablo Vélez 2025-05-15 00:25:47 +02:00 committed by GitHub
parent 934ed2a773
commit 84a1520698
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 24 additions and 3 deletions

View file

@ -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: [

View file

@ -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,
};
};
}

View file

@ -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({

View file

@ -43,7 +43,7 @@ import {
} from './table_schemas';
export const serverSchema: AppSchema = appSchema({
version: 10,
version: 11,
tables: [
CategorySchema,
CategoryChannelSchema,

View file

@ -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},
],
});

View file

@ -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]: {

View file

@ -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>;