Examples: queryAccess method
This agent prints the access level for the current user.
import lotus.domino.*;
public class JavaAgent extends AgentBase {
public void NotesMain() {
try {
Session session = getSession();
AgentContext agentContext =
session.getAgentContext();
// (Your code goes here)
Database db = agentContext.getCurrentDatabase();
String title = db.getTitle();
int accLevel =
db.queryAccess(session.getUserName());
System.out.print
("For database \"" + title + "\" you have ");
switch (accLevel) {
case(ACL.LEVEL_NOACCESS) :
System.out.println("no access");
break;
case(ACL.LEVEL_DEPOSITOR) :
System.out.println("depositor access");
break;
case(ACL.LEVEL_READER) :
System.out.println("reader access");
break;
case(ACL.LEVEL_AUTHOR) :
System.out.println("author access");
break;
case(ACL.LEVEL_EDITOR) :
System.out.println("editor access");
break;
case(ACL.LEVEL_DESIGNER) :
System.out.println("designer access");
break;
case(ACL.LEVEL_MANAGER) :
System.out.println("manager access");
break;
default:
System.out.println("unknown access");
break; }
} catch(Exception e) {
e.printStackTrace();
}
}
}