Code: Select all
tables.CREDENTIALS.insertRow();
tables.CREDENTIALS.ID.value="USERID";
tables.CREDENTIALS.VALUE.value=tables.USERS.USERID.value;
tables.CREDENTIALS.updateTable();
Whenever a user wants to access one of my applications, the Before Page event calls a globally shared function that verifies whether the user has permission to access that specific application. I have added a check in this function to make sure that UserID credential is set and that the user is logged on. If either condition is true (user id is not set or the user is not logged in, an error message is displayed and the user has to log on again.
Code: Select all
if (isNaN(parseInt(system.securityManager.getCredential("USERID"))) == true || system.securityManager.isUserLoggedOn() == false) {
// Add log to record entry that the user ID is not set
// In order to help me debug why this the username credential is getting unset (It shouldn't be!), I use an if to adda different log message to
// help me differentiate what caused this if statement to evaulate to true
if (isNaN(parseInt(system.securityManager.getCredential("USERID"))) == true) {
addIntranetLog(null,(system.securityManager.getCredential("REALNAME") != null ? system.securityManager.getCredential("REALNAME") : null),"The User ID is not set in verifyUserSession()","SESSION TIMEOUT",(system.variables.$BROWSER_IP_ADDRESS.value != null ? system.variables.$BROWSER_IP_ADDRESS.value : null));
} else {
addIntranetLog(null,(system.securityManager.getCredential("REALNAME") != null ? system.securityManager.getCredential("REALNAME") : null),"The user is not logged in coming from verifyUserSession()","SESSION TIMEOUT",(system.variables.$BROWSER_IP_ADDRESS.value != null ? system.variables.$BROWSER_IP_ADDRESS.value : null));
}
// Because form.abort is called below, I have to make this call to force the transaction to be committed. Otherwise, form.abort will roll back the transaction
system.transactionManager.commitAndRestartTransaction();
try {
form.abort((system.securityManager.getCredential("REALNAME") != null ? "Sorry " + system.securityManager.getCredential("REALNAME") + " but your" : "Your") + " Intranet session has timed out and you will be logged out now.");
} finally {
system.securityManager.logoff();
}
}
Code: Select all
if (isNaN(parseInt(system.securityManager.getCredential("USERID"))) == true) {