Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  1. For AAM-1140 issue need to perform these SQL fixes:

    Upload the latest security_module template.

    Code Block
    update system_template set template_id = '64b0d486-bc51-476b-bab0-9c78221f8422' where name = 'SECURITY_MODULE'; 
    
    delete from keycloak.user_role_mapping where role_id in (select id from keycloak.keycloak_role where name like 'am|rg|%');
    delete from keycloak.keycloak_role where name like 'am|rg|%';
    
    do $$
        declare
            r record;
            sql varchar;
            b boolean;
        begin
            for r in select id from project where archive_initialized = true and exists (select project_id from project_system_template where project_id = id and template_name = 'SECURITY_MODULE')
                loop
                    execute format('alter table %s.restriction alter column number_of_years drop not null', r.id);
                    execute format('alter table %s.object_restriction alter column planned_termination_year drop not null', r.id);
    
                                execute format('drop table if exists %s.content_screening', r.id);
                    execute format('drop table if exists %s.content_access_group', r.id);
    
                    execute format('create table if not exists %s.content_access_group
    (
        _amid       uuid default uuid_generate_v4()   not null
            unique,
        created     timestamp,
        created_by  varchar,
        updated     timestamp,
        updated_by  varchar,
        type        varchar                           not null,
        id          uuid default uuid_generate_v1mc() not null
            primary key,
        name        varchar(36)                       not null
            unique,
        description varchar
    )', r.id);
                    execute format('alter table %s.content_access_group owner to "archive-manager"', r.id);
    
                    execute format('create table if not exists %s.content_screening
    (
        _amid                uuid default uuid_generate_v4() not null
            unique,
        created              timestamp,
        created_by           varchar,
        updated              timestamp,
        updated_by           varchar,
        cag_id               uuid                            not null
            constraint fk_29d876ad_dd73_4c04_aa9f_8655e43c7a82
                references %s.content_access_group
                deferrable initially deferred,
        object_id            uuid                            not null,
        table_name_reference varchar                         not null,
        scope                varchar                         not null,
        field_names          varchar(2000),
        constraint content_screening_pk
            primary key (object_id, cag_id)
    )', r.id, r.id);
                    execute format('alter table %s.content_screening owner to "archive-manager"', r.id);
    
                    execute format('select exists(select from %s.coding_scheme where name = ''security'') and not exists(select from %s.code_table where name = ''contentAccessGroupType'')', r.id, r.id) into b;
                    if b then
                        execute format('insert into %s.code_table(name, cs_name) values(''contentAccessGroupType'', ''security'') on conflict do nothing', r.id);
                        execute format('insert into %s.code_table(name, cs_name) values(''contentScreeningScope'', ''security'') on conflict do nothing', r.id);
                        execute format('insert into %s.code_value(ct_name, code, value) values(''contentAccessGroupType'', ''NORMAL'', ''Normal'')', r.id);
                        execute format('insert into %s.code_value(ct_name, code, value) values(''contentAccessGroupType'', ''RESTRICTED'', ''Begrenset'')', r.id);
                        execute format('delete from %s.code_value where ct_name = ''contentScreeningScope'' and code = ''100''', r.id);
                        execute format('insert into %s.code_value(_amid, code, ct_name, value, uid) values (''42755dd9-cc42-4559-9afa-ae22727ab506'', ''40'', ''contentScreeningScope'', ''Kan gjøre hva som helst'', ''9ab730d6-1f7d-4dbb-bc17-7290f668f21f'')', r.id);
                    end if;
                end loop;
    
            for r in select id from project where archive_initialized = true and exists (select project_id from project_system_template where project_id = id and template_name = 'PARTICIPANT_MODULE')
                loop
                    execute format('alter table %s.aktor_struktur add column if not exists startdato varchar null', r.id);
                    execute format('alter table %s.aktor_struktur add column if not exists sluttdato varchar null', r.id);
                    execute format('alter table %s.alternativt_navn add column if not exists type varchar null', r.id);
                end loop;
        end; $$

    MongoDB

    Code Block
    db.getCollection("fs.screening").drop();

    Elasticsearch

    Code Block
    curl -XDELETE localhost:9200/*==digital-files

    Then reindex all the projects.

  2. For AAM-1147 issue need to perform this SQL fix:

    Upload the latest participant_module template.

...