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
// 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");
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");
......@@ -320,11 +320,13 @@ public class UserRightsPrc extends ProcessEJB implements UserRightsPrcLocal , U
{
System.out.println("SQLException ::" + sqlStr + e.getMessage() + ":");
e.printStackTrace();
throw new ITMException(e);// added by akhilesh on 31/oct/12
}
catch(Exception ex)
{
System.out.println("Exception []::" + ex.getMessage());
ex.printStackTrace();
throw new ITMException(ex);// added by akhilesh on 31/oct/12
}
finally
{
......@@ -339,7 +341,9 @@ public class UserRightsPrc extends ProcessEJB implements UserRightsPrcLocal , U
conn.close();
conn = null;
}
catch(Exception e){}
catch(Exception e){
throw new ITMException(e);// added by akhilesh on 31/oct/12
}
}
resultString = retTabSepStrBuff.toString();
......@@ -388,11 +392,12 @@ public class UserRightsPrc extends ProcessEJB implements UserRightsPrcLocal , U
PreparedStatement pInsertStmt = null;
PreparedStatement pUpdateStmt = null;
PreparedStatement pDeleteStmt = null;
PreparedStatement pSelectStmt = null;// added by akhilesh on 31/oct/12
Statement stmt = null;
ResultSet rs = null;
java.sql.Timestamp orderDate = new java.sql.Timestamp(System.currentTimeMillis());
java.sql.Timestamp udfDate = null;
ArrayList relArray = new ArrayList();
ArrayList relArray = new ArrayList(); // added by akhilesh on 31/oct/12
String returnString = "";
//Declaring fields of the table User_Rights
......@@ -404,6 +409,7 @@ public class UserRightsPrc extends ProcessEJB implements UserRightsPrcLocal , U
String accFilt = null;
String defFilt = null;
String objName = null;
String winName = null;
NodeList parentNodeList = null;
NodeList childNodeList = null;
......@@ -546,13 +552,53 @@ public class UserRightsPrc extends ProcessEJB implements UserRightsPrcLocal , U
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("rights::::"+ rights);
System.out.println("r************"+relArray+""+rights);
returnString="VTRIGHT";
returnString = itmDBAccessEJB.getErrorString("",returnString,"","",conn);
return returnString;
}
//ended by akhilesh
/*}commented by akhilesh on 31/oct/12
else
rights = null;
rights = null;*/
}
}
......@@ -594,11 +640,11 @@ public class UserRightsPrc extends ProcessEJB implements UserRightsPrcLocal , U
for(int index = 0; index < subMenuList.size(); index++)
{
String searchStr = null;
searchStr = (String)subMenuList.get(index);
objName = "";
System.out.print("obj name @@@@@@@@@@@@"+objName+""+searchStr+""+index+""+subMenuList.size());
objName = (String)winNameMap.get(searchStr);
System.out.print("obj name @@@@@@@@@@@@"+objName+""+searchStr+""+index+""+subMenuList.size());
//Get parameters from searchStr
StringTokenizer subMenuToken = new StringTokenizer(searchStr, ":");
......@@ -705,23 +751,30 @@ public class UserRightsPrc extends ProcessEJB implements UserRightsPrcLocal , U
returnString = be.getMessage();
System.out.println("BatchUpdateException :RunMRPPrcEJB: CreatePlanDemand(ADPElement)" + returnString);
System.out.println("Detail Exception : " + be.getNextException());
throw new ITMException(be);// added by akhilesh on 31/oct/12
}
catch (SQLException ex)
{
returnString = ex.getMessage();
try{conn.rollback();
}catch(Exception e){}
}catch(Exception e){
throw new ITMException(e);// added by akhilesh on 31/oct/12
}
ex.printStackTrace();
throw new ITMException(ex);// added by akhilesh on 31/oct/12
}
catch (Exception e)
{
returnString = e.getMessage();
try{
conn.rollback();
}catch(Exception ec){}
}catch(Exception ec){
throw new ITMException(ec);// added by akhilesh on 31/oct/12
}
e.printStackTrace();
throw new ITMException(e);// added by akhilesh on 31/oct/12
}
finally
{
......@@ -742,7 +795,10 @@ public class UserRightsPrc extends ProcessEJB implements UserRightsPrcLocal , U
conn.close();
conn = null;
}catch(Exception e){}
}catch(Exception e){
throw new ITMException(e);// added by akhilesh on 31/oct/12
}
//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