From 7cabc12ebd9251bd77d5f74199890f435a1572f6 Mon Sep 17 00:00:00 2001 From: Nicolas Micoud <58596990+nmicoud@users.noreply.github.com> Date: Thu, 3 Mar 2022 16:19:54 +0100 Subject: [PATCH] IDEMPIERE-5214 : Add AD_Role.IsClientAdministrator (#1220) * IDEMPIERE-5214 : Add AD_Role.IsClientAdministrator * IDEMPIERE-5214 : Add AD_Role.IsClientAdministrator - move scripts to i9 * IDEMPIERE-5214 : Add AD_Role.IsClientAdministrator - set value for new tenants Co-Authored-By: Carlos Ruiz --- .../i9/oracle/202203031417_IDEMPIERE-5214.sql | 88 +++++++++++++++++++ .../202203031417_IDEMPIERE-5214.sql | 85 ++++++++++++++++++ .../src/org/compiere/model/I_AD_Role.java | 15 +++- .../src/org/compiere/model/MSetup.java | 2 + .../src/org/compiere/model/X_AD_Role.java | 31 ++++++- .../src/org/compiere/util/Env.java | 1 + .../src/org/compiere/util/Login.java | 6 +- .../org/adempiere/webui/AdempiereWebUI.java | 1 + 8 files changed, 224 insertions(+), 5 deletions(-) create mode 100644 migration/i9/oracle/202203031417_IDEMPIERE-5214.sql create mode 100644 migration/i9/postgresql/202203031417_IDEMPIERE-5214.sql diff --git a/migration/i9/oracle/202203031417_IDEMPIERE-5214.sql b/migration/i9/oracle/202203031417_IDEMPIERE-5214.sql new file mode 100644 index 0000000000..78d2d68f3e --- /dev/null +++ b/migration/i9/oracle/202203031417_IDEMPIERE-5214.sql @@ -0,0 +1,88 @@ +-- IDEMPIERE-5214 +SELECT register_migration_script('202203031417_IDEMPIERE-5214.sql') FROM dual; + +SET SQLBLANKLINES ON +SET DEFINE OFF + +-- Mar 3, 2022, 2:17:27 PM CET +INSERT INTO AD_Element (AD_Element_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,ColumnName,Name,Description,PrintName,EntityType,AD_Element_UU) VALUES (203566,0,0,'Y',TO_TIMESTAMP('2022-03-03 14:17:27','YYYY-MM-DD HH24:MI:SS'),0,TO_TIMESTAMP('2022-03-03 14:17:27','YYYY-MM-DD HH24:MI:SS'),0,'IsClientAdministrator','Client Administrator','This role is a client administrator','Client Administrator','D','82757516-f616-41ee-bc22-7be819e4cafa') +; + +-- Mar 3, 2022, 2:18:01 PM CET +INSERT INTO AD_Column (AD_Column_ID,Version,Name,Description,AD_Table_ID,ColumnName,DefaultValue,FieldLength,IsKey,IsParent,IsMandatory,IsTranslated,IsIdentifier,SeqNo,IsEncrypted,AD_Reference_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Element_ID,IsUpdateable,IsSelectionColumn,EntityType,IsSyncDatabase,IsAlwaysUpdateable,IsAutocomplete,IsAllowLogging,AD_Column_UU,IsAllowCopy,SeqNoSelection,IsToolbarButton,IsSecure,FKConstraintType,IsHtml) VALUES (214711,0,'Client Administrator','This role is a client administrator',156,'IsClientAdministrator','N',1,'N','N','Y','N','N',0,'N',20,0,0,'Y',TO_TIMESTAMP('2022-03-03 14:18:01','YYYY-MM-DD HH24:MI:SS'),0,TO_TIMESTAMP('2022-03-03 14:18:01','YYYY-MM-DD HH24:MI:SS'),0,203566,'Y','N','D','N','N','N','Y','62f1e781-cdde-4a70-879e-a37fa30398ea','Y',0,'N','N','N','N') +; + +-- Mar 3, 2022, 2:18:02 PM CET +ALTER TABLE AD_Role ADD IsClientAdministrator CHAR(1) DEFAULT 'N' CHECK (IsClientAdministrator IN ('Y','N')) NOT NULL +; + +-- Mar 3, 2022, 2:18:15 PM CET +INSERT INTO AD_Field (AD_Field_ID,Name,Description,AD_Tab_ID,AD_Column_ID,IsDisplayed,DisplayLength,SeqNo,IsSameLine,IsHeading,IsFieldOnly,IsEncrypted,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadOnly,IsCentrallyMaintained,EntityType,AD_Field_UU,IsDisplayedGrid,SeqNoGrid,XPosition,ColumnSpan) VALUES (206904,'Client Administrator','This role is a client administrator',119,214711,'Y',1,450,'N','N','N','N',0,0,'Y',TO_TIMESTAMP('2022-03-03 14:18:15','YYYY-MM-DD HH24:MI:SS'),0,TO_TIMESTAMP('2022-03-03 14:18:15','YYYY-MM-DD HH24:MI:SS'),0,'N','Y','D','00ef90d5-1086-4c52-b0bd-a632731b8b4a','Y',450,2,2) +; + +-- Mar 3, 2022, 2:18:33 PM CET +UPDATE AD_Field SET IsDisplayed='Y', SeqNo=260, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=4, ColumnSpan=1, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2022-03-03 14:18:33','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Field_ID=206904 +; + +-- Mar 3, 2022, 2:18:33 PM CET +UPDATE AD_Field SET SeqNo=270, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2022-03-03 14:18:33','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Field_ID=8311 +; + +-- Mar 3, 2022, 2:18:33 PM CET +UPDATE AD_Field SET SeqNo=280, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2022-03-03 14:18:33','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Field_ID=11006 +; + +-- Mar 3, 2022, 2:18:33 PM CET +UPDATE AD_Field SET SeqNo=290, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2022-03-03 14:18:33','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Field_ID=12367 +; + +-- Mar 3, 2022, 2:18:33 PM CET +UPDATE AD_Field SET SeqNo=300, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2022-03-03 14:18:33','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Field_ID=12368 +; + +-- Mar 3, 2022, 2:18:33 PM CET +UPDATE AD_Field SET SeqNo=310, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2022-03-03 14:18:33','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Field_ID=11256 +; + +-- Mar 3, 2022, 2:18:33 PM CET +UPDATE AD_Field SET SeqNo=320, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2022-03-03 14:18:33','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Field_ID=50168 +; + +-- Mar 3, 2022, 2:18:33 PM CET +UPDATE AD_Field SET SeqNo=330, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2022-03-03 14:18:33','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Field_ID=50178 +; + +-- Mar 3, 2022, 2:18:33 PM CET +UPDATE AD_Field SET SeqNo=340, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2022-03-03 14:18:33','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Field_ID=50176 +; + +-- Mar 3, 2022, 2:18:33 PM CET +UPDATE AD_Field SET SeqNo=350, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2022-03-03 14:18:33','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Field_ID=50170 +; + +-- Mar 3, 2022, 2:18:33 PM CET +UPDATE AD_Field SET SeqNo=360, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2022-03-03 14:18:33','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Field_ID=50174 +; + +-- Mar 3, 2022, 2:18:33 PM CET +UPDATE AD_Field SET SeqNo=370, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2022-03-03 14:18:33','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Field_ID=50173 +; + +-- Mar 3, 2022, 2:18:33 PM CET +UPDATE AD_Field SET SeqNo=380, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2022-03-03 14:18:33','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Field_ID=50172 +; + +-- Mar 3, 2022, 2:18:33 PM CET +UPDATE AD_Field SET SeqNo=390, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2022-03-03 14:18:33','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Field_ID=50175 +; + +-- Mar 3, 2022, 2:18:33 PM CET +UPDATE AD_Field SET SeqNo=400, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2022-03-03 14:18:33','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Field_ID=50169 +; + +-- Mar 3, 2022, 2:18:33 PM CET +UPDATE AD_Field SET SeqNo=410, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2022-03-03 14:18:33','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Field_ID=50177 +; + +-- Set GardenWorld Admin and GardenWorld Admin Not Advanced roles as Client Administrator +UPDATE AD_Role SET IsClientAdministrator = 'Y' WHERE AD_Role_ID IN (102, 200001); diff --git a/migration/i9/postgresql/202203031417_IDEMPIERE-5214.sql b/migration/i9/postgresql/202203031417_IDEMPIERE-5214.sql new file mode 100644 index 0000000000..a5e03409e8 --- /dev/null +++ b/migration/i9/postgresql/202203031417_IDEMPIERE-5214.sql @@ -0,0 +1,85 @@ +-- IDEMPIERE-5214 +SELECT register_migration_script('202203031417_IDEMPIERE-5214.sql') FROM dual; + +-- Mar 3, 2022, 2:17:27 PM CET +INSERT INTO AD_Element (AD_Element_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,ColumnName,Name,Description,PrintName,EntityType,AD_Element_UU) VALUES (203566,0,0,'Y',TO_TIMESTAMP('2022-03-03 14:17:27','YYYY-MM-DD HH24:MI:SS'),0,TO_TIMESTAMP('2022-03-03 14:17:27','YYYY-MM-DD HH24:MI:SS'),0,'IsClientAdministrator','Client Administrator','This role is a client administrator','Client Administrator','D','82757516-f616-41ee-bc22-7be819e4cafa') +; + +-- Mar 3, 2022, 2:18:01 PM CET +INSERT INTO AD_Column (AD_Column_ID,Version,Name,Description,AD_Table_ID,ColumnName,DefaultValue,FieldLength,IsKey,IsParent,IsMandatory,IsTranslated,IsIdentifier,SeqNo,IsEncrypted,AD_Reference_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Element_ID,IsUpdateable,IsSelectionColumn,EntityType,IsSyncDatabase,IsAlwaysUpdateable,IsAutocomplete,IsAllowLogging,AD_Column_UU,IsAllowCopy,SeqNoSelection,IsToolbarButton,IsSecure,FKConstraintType,IsHtml) VALUES (214711,0,'Client Administrator','This role is a client administrator',156,'IsClientAdministrator','N',1,'N','N','Y','N','N',0,'N',20,0,0,'Y',TO_TIMESTAMP('2022-03-03 14:18:01','YYYY-MM-DD HH24:MI:SS'),0,TO_TIMESTAMP('2022-03-03 14:18:01','YYYY-MM-DD HH24:MI:SS'),0,203566,'Y','N','D','N','N','N','Y','62f1e781-cdde-4a70-879e-a37fa30398ea','Y',0,'N','N','N','N') +; + +-- Mar 3, 2022, 2:18:02 PM CET +ALTER TABLE AD_Role ADD COLUMN IsClientAdministrator CHAR(1) DEFAULT 'N' CHECK (IsClientAdministrator IN ('Y','N')) NOT NULL +; + +-- Mar 3, 2022, 2:18:15 PM CET +INSERT INTO AD_Field (AD_Field_ID,Name,Description,AD_Tab_ID,AD_Column_ID,IsDisplayed,DisplayLength,SeqNo,IsSameLine,IsHeading,IsFieldOnly,IsEncrypted,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadOnly,IsCentrallyMaintained,EntityType,AD_Field_UU,IsDisplayedGrid,SeqNoGrid,XPosition,ColumnSpan) VALUES (206904,'Client Administrator','This role is a client administrator',119,214711,'Y',1,450,'N','N','N','N',0,0,'Y',TO_TIMESTAMP('2022-03-03 14:18:15','YYYY-MM-DD HH24:MI:SS'),0,TO_TIMESTAMP('2022-03-03 14:18:15','YYYY-MM-DD HH24:MI:SS'),0,'N','Y','D','00ef90d5-1086-4c52-b0bd-a632731b8b4a','Y',450,2,2) +; + +-- Mar 3, 2022, 2:18:33 PM CET +UPDATE AD_Field SET IsDisplayed='Y', SeqNo=260, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=4, ColumnSpan=1, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2022-03-03 14:18:33','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Field_ID=206904 +; + +-- Mar 3, 2022, 2:18:33 PM CET +UPDATE AD_Field SET SeqNo=270, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2022-03-03 14:18:33','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Field_ID=8311 +; + +-- Mar 3, 2022, 2:18:33 PM CET +UPDATE AD_Field SET SeqNo=280, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2022-03-03 14:18:33','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Field_ID=11006 +; + +-- Mar 3, 2022, 2:18:33 PM CET +UPDATE AD_Field SET SeqNo=290, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2022-03-03 14:18:33','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Field_ID=12367 +; + +-- Mar 3, 2022, 2:18:33 PM CET +UPDATE AD_Field SET SeqNo=300, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2022-03-03 14:18:33','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Field_ID=12368 +; + +-- Mar 3, 2022, 2:18:33 PM CET +UPDATE AD_Field SET SeqNo=310, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2022-03-03 14:18:33','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Field_ID=11256 +; + +-- Mar 3, 2022, 2:18:33 PM CET +UPDATE AD_Field SET SeqNo=320, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2022-03-03 14:18:33','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Field_ID=50168 +; + +-- Mar 3, 2022, 2:18:33 PM CET +UPDATE AD_Field SET SeqNo=330, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2022-03-03 14:18:33','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Field_ID=50178 +; + +-- Mar 3, 2022, 2:18:33 PM CET +UPDATE AD_Field SET SeqNo=340, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2022-03-03 14:18:33','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Field_ID=50176 +; + +-- Mar 3, 2022, 2:18:33 PM CET +UPDATE AD_Field SET SeqNo=350, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2022-03-03 14:18:33','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Field_ID=50170 +; + +-- Mar 3, 2022, 2:18:33 PM CET +UPDATE AD_Field SET SeqNo=360, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2022-03-03 14:18:33','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Field_ID=50174 +; + +-- Mar 3, 2022, 2:18:33 PM CET +UPDATE AD_Field SET SeqNo=370, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2022-03-03 14:18:33','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Field_ID=50173 +; + +-- Mar 3, 2022, 2:18:33 PM CET +UPDATE AD_Field SET SeqNo=380, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2022-03-03 14:18:33','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Field_ID=50172 +; + +-- Mar 3, 2022, 2:18:33 PM CET +UPDATE AD_Field SET SeqNo=390, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2022-03-03 14:18:33','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Field_ID=50175 +; + +-- Mar 3, 2022, 2:18:33 PM CET +UPDATE AD_Field SET SeqNo=400, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2022-03-03 14:18:33','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Field_ID=50169 +; + +-- Mar 3, 2022, 2:18:33 PM CET +UPDATE AD_Field SET SeqNo=410, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2022-03-03 14:18:33','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Field_ID=50177 +; + +-- Set GardenWorld Admin and GardenWorld Admin Not Advanced roles as Client Administrator +UPDATE AD_Role SET IsClientAdministrator = 'Y' WHERE AD_Role_ID IN (102, 200001); diff --git a/org.adempiere.base/src/org/compiere/model/I_AD_Role.java b/org.adempiere.base/src/org/compiere/model/I_AD_Role.java index ac59a9826d..87c4a45d32 100644 --- a/org.adempiere.base/src/org/compiere/model/I_AD_Role.java +++ b/org.adempiere.base/src/org/compiere/model/I_AD_Role.java @@ -22,7 +22,7 @@ import org.compiere.util.KeyNamePair; /** Generated Interface for AD_Role * @author iDempiere (generated) - * @version Release 9 + * @version Release 10 */ public interface I_AD_Role { @@ -387,6 +387,19 @@ public interface I_AD_Role */ public boolean isChangeLog(); + /** Column name IsClientAdministrator */ + public static final String COLUMNNAME_IsClientAdministrator = "IsClientAdministrator"; + + /** Set Client Administrator. + * This role is a client administrator + */ + public void setIsClientAdministrator (boolean IsClientAdministrator); + + /** Get Client Administrator. + * This role is a client administrator + */ + public boolean isClientAdministrator(); + /** Column name IsDiscountAllowedOnTotal */ public static final String COLUMNNAME_IsDiscountAllowedOnTotal = "IsDiscountAllowedOnTotal"; diff --git a/org.adempiere.base/src/org/compiere/model/MSetup.java b/org.adempiere.base/src/org/compiere/model/MSetup.java index de8223da14..8a8fb4375f 100644 --- a/org.adempiere.base/src/org/compiere/model/MSetup.java +++ b/org.adempiere.base/src/org/compiere/model/MSetup.java @@ -244,6 +244,7 @@ public final class MSetup admin.setPreferenceType(MRole.PREFERENCETYPE_Client); admin.setIsShowAcct(true); admin.setIsAccessAdvanced(true); + admin.setIsClientAdministrator(true); if (!admin.save()) { String err = "Admin Role A NOT inserted"; @@ -271,6 +272,7 @@ public final class MSetup user.setClientOrg(m_client); user.setName(name); user.setIsAccessAdvanced(false); + user.setIsClientAdministrator(false); if (!user.save()) { String err = "User Role A NOT inserted"; diff --git a/org.adempiere.base/src/org/compiere/model/X_AD_Role.java b/org.adempiere.base/src/org/compiere/model/X_AD_Role.java index 5f101f6656..15b340f932 100644 --- a/org.adempiere.base/src/org/compiere/model/X_AD_Role.java +++ b/org.adempiere.base/src/org/compiere/model/X_AD_Role.java @@ -25,7 +25,7 @@ import org.compiere.util.KeyNamePair; /** Generated Model for AD_Role * @author iDempiere (generated) - * @version Release 9 - $Id$ */ + * @version Release 10 - $Id$ */ @org.adempiere.base.Model(table="AD_Role") public class X_AD_Role extends PO implements I_AD_Role, I_Persistent { @@ -33,7 +33,7 @@ public class X_AD_Role extends PO implements I_AD_Role, I_Persistent /** * */ - private static final long serialVersionUID = 20220116L; + private static final long serialVersionUID = 20220303L; /** Standard Constructor */ public X_AD_Role (Properties ctx, int AD_Role_ID, String trxName) @@ -72,6 +72,8 @@ public class X_AD_Role extends PO implements I_AD_Role, I_Persistent setIsCanReport (true); // Y setIsChangeLog (false); +// N + setIsClientAdministrator (false); // N setIsDiscountAllowedOnTotal (false); setIsDiscountUptoLimitPrice (false); @@ -137,6 +139,8 @@ public class X_AD_Role extends PO implements I_AD_Role, I_Persistent setIsCanReport (true); // Y setIsChangeLog (false); +// N + setIsClientAdministrator (false); // N setIsDiscountAllowedOnTotal (false); setIsDiscountUptoLimitPrice (false); @@ -763,6 +767,29 @@ public class X_AD_Role extends PO implements I_AD_Role, I_Persistent return false; } + /** Set Client Administrator. + @param IsClientAdministrator This role is a client administrator + */ + public void setIsClientAdministrator (boolean IsClientAdministrator) + { + set_Value (COLUMNNAME_IsClientAdministrator, Boolean.valueOf(IsClientAdministrator)); + } + + /** Get Client Administrator. + @return This role is a client administrator + */ + public boolean isClientAdministrator() + { + Object oo = get_Value(COLUMNNAME_IsClientAdministrator); + if (oo != null) + { + if (oo instanceof Boolean) + return ((Boolean)oo).booleanValue(); + return "Y".equals(oo); + } + return false; + } + /** Set IsDiscountAllowedOnTotal. @param IsDiscountAllowedOnTotal IsDiscountAllowedOnTotal */ diff --git a/org.adempiere.base/src/org/compiere/util/Env.java b/org.adempiere.base/src/org/compiere/util/Env.java index 7ea1b624fd..682c66b37c 100644 --- a/org.adempiere.base/src/org/compiere/util/Env.java +++ b/org.adempiere.base/src/org/compiere/util/Env.java @@ -106,6 +106,7 @@ public final class Env public static final String DB_TYPE = "#DBType"; public static final String GL_CATEGORY_ID = "#GL_Category_ID"; public static final String HAS_ALIAS = "$HasAlias"; + public static final String IS_CLIENT_ADMIN = "#IsClientAdmin"; /** Context Language identifier */ public static final String LANGUAGE = "#AD_Language"; public static final String LANGUAGE_NAME = "#LanguageName"; diff --git a/org.adempiere.base/src/org/compiere/util/Login.java b/org.adempiere.base/src/org/compiere/util/Login.java index d5ddf22f15..2b139d0ca5 100644 --- a/org.adempiere.base/src/org/compiere/util/Login.java +++ b/org.adempiere.base/src/org/compiere/util/Login.java @@ -469,7 +469,7 @@ public class Login ArrayList list = new ArrayList(); KeyNamePair[] retValue = null; String sql = "SELECT DISTINCT r.UserLevel, r.ConnectionProfile, " // 1/2 - + " c.AD_Client_ID,c.Name,r.RoleType " // 3/4/5 + + " c.AD_Client_ID,c.Name,r.RoleType,r.IsClientAdministrator " // 3/4/5/6 + "FROM AD_Role r" + " INNER JOIN AD_Client c ON (r.AD_Client_ID=c.AD_Client_ID) " + "WHERE r.AD_Role_ID=?" // #1 @@ -494,6 +494,7 @@ public class Login Env.setContext(m_ctx, Env.AD_ROLE_ID, role.getKey()); Env.setContext(m_ctx, Env.AD_ROLE_NAME, role.getName()); Env.setContext(m_ctx, Env.AD_ROLE_TYPE, rs.getString("RoleType")); + Env.setContext(m_ctx, Env.IS_CLIENT_ADMIN, rs.getString("IsClientAdministrator")); Ini.setProperty(Ini.P_ROLE, role.getName()); // User Level Env.setContext(m_ctx, Env.USER_LEVEL, rs.getString(1)); // Format 'SCO' @@ -547,7 +548,7 @@ public class Login ArrayList list = new ArrayList(); KeyNamePair[] retValue = null; // - String sql = " SELECT DISTINCT r.UserLevel, r.ConnectionProfile,o.AD_Org_ID,o.Name,o.IsSummary,r.RoleType " + String sql = " SELECT DISTINCT r.UserLevel, r.ConnectionProfile,o.AD_Org_ID,o.Name,o.IsSummary,r.RoleType,r.IsClientAdministrator " +" FROM AD_Org o" +" INNER JOIN AD_Role r on (r.AD_Role_ID=?)" +" INNER JOIN AD_Client c on (c.AD_Client_ID=?)" @@ -581,6 +582,7 @@ public class Login Env.setContext(m_ctx, Env.AD_ROLE_ID, rol.getKey()); Env.setContext(m_ctx, Env.AD_ROLE_NAME, rol.getName()); Env.setContext(m_ctx, Env.AD_ROLE_TYPE, rs.getString("RoleType")); + Env.setContext(m_ctx, Env.IS_CLIENT_ADMIN, rs.getString("IsClientAdministrator")); Ini.setProperty(Ini.P_ROLE, rol.getName()); // User Level Env.setContext(m_ctx, Env.USER_LEVEL, rs.getString(1)); // Format 'SCO' diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/AdempiereWebUI.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/AdempiereWebUI.java index 3f0ce553d7..0d1ee8a313 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/AdempiereWebUI.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/AdempiereWebUI.java @@ -591,6 +591,7 @@ public class AdempiereWebUI extends Window implements EventListener, IWeb Env.setContext(properties, Env.AD_ROLE_ID, Env.getAD_Role_ID(Env.getCtx())); Env.setContext(properties, Env.AD_ROLE_NAME, Env.getContext(Env.getCtx(), Env.AD_ROLE_NAME)); Env.setContext(properties, Env.AD_ROLE_TYPE, Env.getContext(Env.getCtx(), Env.AD_ROLE_TYPE)); + Env.setContext(properties, Env.IS_CLIENT_ADMIN, Env.getContext(Env.getCtx(), Env.IS_CLIENT_ADMIN)); Env.setContext(properties, Env.USER_LEVEL, Env.getContext(Env.getCtx(), Env.USER_LEVEL)); Env.setContext(properties, Env.AD_ORG_NAME, Env.getContext(Env.getCtx(), Env.AD_ORG_NAME)); Env.setContext(properties, Env.M_WAREHOUSE_ID, Env.getContext(Env.getCtx(), Env.M_WAREHOUSE_ID));