Commit 69802f77 authored by asikarwar's avatar asikarwar

add validation of rights in process


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@92126 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 3f0c2edf
...@@ -133,7 +133,7 @@ public class UserRightsPrc extends ProcessEJB implements UserRightsPrcLocal , U ...@@ -133,7 +133,7 @@ public class UserRightsPrc extends ProcessEJB implements UserRightsPrcLocal , U
// 24/03/12 manoharan get the current logged in user and show only the menus for which the current user has rights // 24/03/12 manoharan get the current logged in user and show only the menus for which the current user has rights
curUserId = genericUtility.getValueFromXTRA_PARAMS(xtraParams, "loginCode"); curUserId = genericUtility.getValueFromXTRA_PARAMS(xtraParams, "loginCode");
System.out.println("Current userid curUserId ["+ curUserId + "] profileId [" + profileId + "]"); System.out.println("Current userid curUserId ["+ curUserId + "] profileId [" + profileId + "]");
if (curUserId == null && curUserId.trim().length() == 0) if (curUserId == null || curUserId.trim().length() == 0)
{ {
retTabSepStrBuff.append(" \t"); retTabSepStrBuff.append(" \t");
...@@ -320,11 +320,13 @@ public class UserRightsPrc extends ProcessEJB implements UserRightsPrcLocal , U ...@@ -320,11 +320,13 @@ public class UserRightsPrc extends ProcessEJB implements UserRightsPrcLocal , U
{ {
System.out.println("SQLException ::" + sqlStr + e.getMessage() + ":"); System.out.println("SQLException ::" + sqlStr + e.getMessage() + ":");
e.printStackTrace(); e.printStackTrace();
throw new ITMException(e);// added by akhilesh on 31/oct/12
} }
catch(Exception ex) catch(Exception ex)
{ {
System.out.println("Exception []::" + ex.getMessage()); System.out.println("Exception []::" + ex.getMessage());
ex.printStackTrace(); ex.printStackTrace();
throw new ITMException(ex);// added by akhilesh on 31/oct/12
} }
finally finally
{ {
...@@ -339,7 +341,9 @@ public class UserRightsPrc extends ProcessEJB implements UserRightsPrcLocal , U ...@@ -339,7 +341,9 @@ public class UserRightsPrc extends ProcessEJB implements UserRightsPrcLocal , U
conn.close(); conn.close();
conn = null; conn = null;
} }
catch(Exception e){} catch(Exception e){
throw new ITMException(e);// added by akhilesh on 31/oct/12
}
} }
resultString = retTabSepStrBuff.toString(); resultString = retTabSepStrBuff.toString();
...@@ -388,11 +392,12 @@ public class UserRightsPrc extends ProcessEJB implements UserRightsPrcLocal , U ...@@ -388,11 +392,12 @@ public class UserRightsPrc extends ProcessEJB implements UserRightsPrcLocal , U
PreparedStatement pInsertStmt = null; PreparedStatement pInsertStmt = null;
PreparedStatement pUpdateStmt = null; PreparedStatement pUpdateStmt = null;
PreparedStatement pDeleteStmt = null; PreparedStatement pDeleteStmt = null;
PreparedStatement pSelectStmt = null;// added by akhilesh on 31/oct/12
Statement stmt = null; Statement stmt = null;
ResultSet rs = null; ResultSet rs = null;
java.sql.Timestamp orderDate = new java.sql.Timestamp(System.currentTimeMillis()); java.sql.Timestamp orderDate = new java.sql.Timestamp(System.currentTimeMillis());
java.sql.Timestamp udfDate = null; java.sql.Timestamp udfDate = null;
ArrayList relArray = new ArrayList(); ArrayList relArray = new ArrayList(); // added by akhilesh on 31/oct/12
String returnString = ""; String returnString = "";
//Declaring fields of the table User_Rights //Declaring fields of the table User_Rights
...@@ -404,6 +409,7 @@ public class UserRightsPrc extends ProcessEJB implements UserRightsPrcLocal , U ...@@ -404,6 +409,7 @@ public class UserRightsPrc extends ProcessEJB implements UserRightsPrcLocal , U
String accFilt = null; String accFilt = null;
String defFilt = null; String defFilt = null;
String objName = null; String objName = null;
String winName = null;
NodeList parentNodeList = null; NodeList parentNodeList = null;
NodeList childNodeList = null; NodeList childNodeList = null;
...@@ -546,13 +552,53 @@ public class UserRightsPrc extends ProcessEJB implements UserRightsPrcLocal , U ...@@ -546,13 +552,53 @@ public class UserRightsPrc extends ProcessEJB implements UserRightsPrcLocal , U
if (childNodeName.equals("rights")) if (childNodeName.equals("rights"))
{ {
if (childNode.getFirstChild() != null) // **************** /*if (childNode.getFirstChild() != null) // ****************
{*/// commented by akhilesh on 31/oct/12
// added by akhilesh on 31/oct/12 for validation rights
if (childNode.getFirstChild() != null )
{
rights = (childNode.getFirstChild().getNodeValue());
}
else
{
rights ="";
}
winName=this.genericUtility.getColumnValue("win_name", detailDom);
System.out.println("windowName ::::"+ windowName);
System.out.println("rights and winName ::::"+ rights+""+winName);
if(winName.trim().length() > 2)
{
objName =winName.substring(2);
}
System.out.println("objName ::::"+ objName);
String selectSql = "SELECT DISTINCT (RIGHTS_CHAR) FROM OBJ_LINKS WHERE OBJ_NAME = ?";
pSelectStmt =conn.prepareStatement(selectSql);
pSelectStmt.setString(1,objName);
rs = pSelectStmt.executeQuery();
while(rs.next())
{
relArray.add(rs.getString(1));
}
System.out.println("relArray and rights value"+relArray+""+rights);
rs.close();
rs = null;
pSelectStmt.close();
pSelectStmt = null;
if(!(relArray.contains(rights) || "*".equals(rights)))
{ {
rights = (childNode.getFirstChild().getNodeValue()).trim(); System.out.println("r************"+relArray+""+rights);
System.out.println("rights::::"+ rights); returnString="VTRIGHT";
returnString = itmDBAccessEJB.getErrorString("",returnString,"","",conn);
return returnString;
} }
//ended by akhilesh
/*}commented by akhilesh on 31/oct/12
else else
rights = null; rights = null;*/
} }
} }
...@@ -594,11 +640,11 @@ public class UserRightsPrc extends ProcessEJB implements UserRightsPrcLocal , U ...@@ -594,11 +640,11 @@ public class UserRightsPrc extends ProcessEJB implements UserRightsPrcLocal , U
for(int index = 0; index < subMenuList.size(); index++) for(int index = 0; index < subMenuList.size(); index++)
{ {
String searchStr = null; String searchStr = null;
searchStr = (String)subMenuList.get(index); searchStr = (String)subMenuList.get(index);
objName = ""; objName = "";
System.out.print("obj name @@@@@@@@@@@@"+objName+""+searchStr+""+index+""+subMenuList.size());
objName = (String)winNameMap.get(searchStr); objName = (String)winNameMap.get(searchStr);
System.out.print("obj name @@@@@@@@@@@@"+objName+""+searchStr+""+index+""+subMenuList.size());
//Get parameters from searchStr //Get parameters from searchStr
StringTokenizer subMenuToken = new StringTokenizer(searchStr, ":"); StringTokenizer subMenuToken = new StringTokenizer(searchStr, ":");
...@@ -705,23 +751,30 @@ public class UserRightsPrc extends ProcessEJB implements UserRightsPrcLocal , U ...@@ -705,23 +751,30 @@ public class UserRightsPrc extends ProcessEJB implements UserRightsPrcLocal , U
returnString = be.getMessage(); returnString = be.getMessage();
System.out.println("BatchUpdateException :RunMRPPrcEJB: CreatePlanDemand(ADPElement)" + returnString); System.out.println("BatchUpdateException :RunMRPPrcEJB: CreatePlanDemand(ADPElement)" + returnString);
System.out.println("Detail Exception : " + be.getNextException()); System.out.println("Detail Exception : " + be.getNextException());
throw new ITMException(be);// added by akhilesh on 31/oct/12
} }
catch (SQLException ex) catch (SQLException ex)
{ {
returnString = ex.getMessage(); returnString = ex.getMessage();
try{conn.rollback(); try{conn.rollback();
}catch(Exception e){} }catch(Exception e){
throw new ITMException(e);// added by akhilesh on 31/oct/12
}
ex.printStackTrace(); ex.printStackTrace();
throw new ITMException(ex);// added by akhilesh on 31/oct/12
} }
catch (Exception e) catch (Exception e)
{ {
returnString = e.getMessage(); returnString = e.getMessage();
try{ try{
conn.rollback(); conn.rollback();
}catch(Exception ec){} }catch(Exception ec){
throw new ITMException(ec);// added by akhilesh on 31/oct/12
}
e.printStackTrace(); e.printStackTrace();
throw new ITMException(e);// added by akhilesh on 31/oct/12
} }
finally finally
{ {
...@@ -742,7 +795,10 @@ public class UserRightsPrc extends ProcessEJB implements UserRightsPrcLocal , U ...@@ -742,7 +795,10 @@ public class UserRightsPrc extends ProcessEJB implements UserRightsPrcLocal , U
conn.close(); conn.close();
conn = null; conn = null;
}catch(Exception e){}
}catch(Exception e){
throw new ITMException(e);// added by akhilesh on 31/oct/12
}
//return returnString; //return returnString;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment