Fixes Issue 13484: User created on Initial Organization Setup has Client Admin role
authorHarikrishnan Raja <harikrishnan.raja@openbravo.com>
Wed, 14 Jul 2010 19:09:09 +0530
changeset 7883 8b98f543308c
parent 7882 99818017822d
child 7884 161d540df8db
Fixes Issue 13484: User created on Initial Organization Setup has Client Admin role
src/org/openbravo/erpCommon/ad_forms/InitialOrgSetup.java
src/org/openbravo/erpCommon/ad_forms/InitialOrgSetup_data.xsql
--- a/src/org/openbravo/erpCommon/ad_forms/InitialOrgSetup.java	Wed Jul 14 16:26:00 2010 +0530
+++ b/src/org/openbravo/erpCommon/ad_forms/InitialOrgSetup.java	Wed Jul 14 19:09:09 2010 +0530
@@ -494,6 +494,21 @@
         releaseRollbackConnection(conn);
         return false;
       }
+      String ad_role_id= SequenceIdData.getUUID();
+      if (InitialOrgSetupData.insertRole(conn, this, AD_Client_ID, ad_role_id, name,AD_Org_ID) != 1) {
+            final String err = "InitialOrgSetup - CreateRole - Role NOT inserted";
+            log4j.warn(err);
+            m_info.append(err).append(SALTO_LINEA);
+            releaseRollbackConnection(conn);
+            return false;
+          }
+      if (InitialOrgSetupData.insertRoleOrgAccess(conn, this, AD_Client_ID, AD_Org_ID, ad_role_id) != 1) {
+          final String err = "InitialOrgSetup - CreateRole - Role Organization NOT inserted";
+          log4j.warn(err);
+          m_info.append(err).append(SALTO_LINEA);
+          releaseRollbackConnection(conn);
+          return false;
+        }
       if (log4j.isDebugEnabled())
         log4j.debug("InitialOrgSetup - createOrg - USER INSERTED " + name);
       // Info
@@ -515,7 +530,7 @@
       // * Create User-Role
 
       // OrgUser - User
-      if (InitialOrgSetupData.insertUserRoles(conn, this, AD_Client_ID, AD_User_U_ID, stradRoleId) != 1)
+      if (InitialOrgSetupData.insertUserRoles(conn, this, AD_Client_ID, AD_User_U_ID, ad_role_id) != 1)
         log4j.warn("InitialOrgSetup - createOrg - UserRole OrgUser+Org NOT inserted");
       releaseCommitConnection(conn);
     } catch (final Exception e) {
--- a/src/org/openbravo/erpCommon/ad_forms/InitialOrgSetup_data.xsql	Wed Jul 14 16:26:00 2010 +0530
+++ b/src/org/openbravo/erpCommon/ad_forms/InitialOrgSetup_data.xsql	Wed Jul 14 19:09:09 2010 +0530
@@ -67,7 +67,7 @@
       <![CDATA[
       INSERT INTO AD_Role (AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Role_ID,Name,
       Description,UserLevel,ClientList,OrgList)
-      VALUES (?,'0','Y',now(),'0',now(),'0',?,?,?,' CO',?,?)
+      VALUES (?,'0','Y',now(),'0',now(),'0',?,?,?,'  O',?,?)
       ]]>
     </Sql>
     <Parameter name="AD_Client_ID"/>