modifiche su utenti

This commit is contained in:
2025-08-07 11:54:53 +02:00
committed by GiuseppeS
parent aff3eaa959
commit 46ef9bd59e
7 changed files with 67 additions and 18 deletions

View File

@@ -63,8 +63,7 @@ public class Migration_20220413102657 extends BaseMigration implements Migration
.setCreationDatetime(wtbUser.getCreationDatetime())
.setPasswordExpiresDays(wtbUser.getPasswordExpiresDays())
.setLastPasswords(wtbUser.getLastPasswords())
.setFlagPasswordExpiring(wtbUser.getFlagPasswordExpiring())
.setDestructionDatetime(wtbUser.getDestructionDatetime());;
.setFlagPasswordExpiring(wtbUser.getFlagPasswordExpiring());
stbUser.setOperation(OperationType.INSERT);
stbUser.manageWithParentConnection(connection, droolsDataCompleting);

View File

@@ -0,0 +1,43 @@
package it.integry.ems.migration.model;
import it.integry.ems.migration._base.BaseMigration;
import it.integry.ems.migration._base.MigrationModelInterface;
public class Migration_20250807105039 extends BaseMigration implements MigrationModelInterface {
@Override
public void up() throws Exception {
if (isHistoryDB())
return;
createOrUpdateView(
"wtb_users",
"CREATE VIEW [dbo].[Wtb_users] AS\n" +
" SELECT [User_name],\n" +
" [Full_name],\n" +
" CASE\n" +
" WHEN stb_user.key_group = 1 OR stb_user.flag_dba = 'S' THEN NULL\n" +
" ELSE dbo.sys_dcd_pss([Password]) END AS [Password],\n" +
" [key_group],\n" +
" [User_code],\n" +
" [Details],\n" +
" [Last_access_datetime],\n" +
" [flag_attivo] AS ctrl_state,\n" +
" [password_endtime],\n" +
" [url_css],\n" +
" [cod_lang],\n" +
" [creation_datetime],\n" +
" [e_mail],\n" +
" [password_expires_days],\n" +
" [last_passwords],\n" +
" [flag_password_expiring],\n" +
" password_endtime AS [destruction_datetime]\n" +
" FROM [dbo].stb_user\n" +
" WHERE flag_extra_user = 'S'\n"
);
}
@Override
public void down() throws Exception {
}
}

View File

@@ -0,0 +1,19 @@
package it.integry.ems.migration.model;
import it.integry.ems.migration._base.BaseMigration;
import it.integry.ems.migration._base.MigrationModelInterface;
public class Migration_20250807112659 extends BaseMigration implements MigrationModelInterface {
@Override
public void up() throws Exception {
if (isHistoryDB())
return;
dropColumn("stb_user", "destruction_datetime");
}
@Override
public void down() throws Exception {
}
}

View File

@@ -204,8 +204,8 @@ public class UserCacheService {
" su.password_endtime,\n" +
" su.cod_lang,\n" +
" su.flag_password_expiring,\n" +
" CAST(IIF(su.destruction_datetime IS NOT NULL AND\n" +
" DATEDIFF(DAY, su.destruction_datetime, GETDATE()) > 0 AND su.flag_password_expiring = 'S', 1,\n" +
" CAST(IIF(su.password_endtime IS NOT NULL AND\n" +
" DATEDIFF(DAY, su.password_endtime, GETDATE()) > 0 AND su.flag_password_expiring = 'S', 1,\n" +
" 0) AS BIT) AS is_password_expired,\n" +
" IIF(su.key_group = '3' AND su.user_code IS NULL, wc.cod_anag, su.user_code) AS user_code,\n" +
" wd.cod_mdep,\n" +

View File

@@ -107,9 +107,6 @@ public class StbUser extends EntityBase {
@SqlField(value = "flag_password_expiring", maxLength = 1, defaultObjectValue = "N")
private String flagPasswordExpiring;
@SqlField(value = "destruction_datetime")
private Date destructionDatetime;
@SqlField(value = "cod_lang", maxLength = 5, defaultObjectValue = "IT")
private String codLang;
@@ -461,15 +458,6 @@ public class StbUser extends EntityBase {
return this;
}
public Date getDestructionDatetime() {
return destructionDatetime;
}
public StbUser setDestructionDatetime(Date destructionDatetime) {
this.destructionDatetime = destructionDatetime;
return this;
}
public String getCodLang() {
return codLang;
}

View File

@@ -46,7 +46,7 @@ public class AgribookUserService {
" password_expires_days,\n" +
" last_passwords,\n" +
" flag_password_expiring,\n" +
" destruction_datetime\n" +
" password_endtime as destruction_datetime\n" +
"FROM Wtb_users\n" +
"WHERE key_group IN (" + String.join("','", listKeyGroupAgronomi) + ")";

View File

@@ -199,7 +199,7 @@ public class SystemService {
" stb_user.flag_password_expiring," +
" CASE WHEN stb_user.key_group = '3' AND stb_user.user_code IS NULL THEN wtb_clie.cod_anag ELSE stb_user.user_code END AS user_code," +
" wtb_depo.cod_mdep," +
" CASE WHEN stb_user.destruction_datetime IS NOT NULL AND DATEDIFF(DAY, stb_user.destruction_datetime, GETDATE()) > 0 AND stb_user.flag_password_expiring = 'S' " +
" CASE WHEN stb_user.password_endtime IS NOT NULL AND DATEDIFF(DAY, stb_user.password_endtime, GETDATE()) > 0 AND stb_user.flag_password_expiring = 'S' " +
" THEN 'N' " +
" ELSE ISNULL(stb_user.flag_attivo, 'N') " +
" END AS flag_attivo," +