/**
* Method to check wether a particular user has access to a provided database
* @param : targetDB- database to which access permissions needs to be checked
* @param : userName- name of the user whose access level is to be checked
* @return : boolean
*/
public boolean checkAccessToDatabase(Database targetDB, String userName) {
boolean accessFlag=false;
int accessLevel=0;
if (targetDB==null){
return accessFlag;
}
try {
if(!targetDB.isOpen()) {
targetDB.open();
}
accessLevel=targetDB.queryAccess(userName);
} catch (NotesException e) {
return accessFlag;
}
if (accessLevel>0){
accessFlag=true;
}
return accessFlag;
}
No comments:
Post a Comment