Examples: queryAccessPrivileges method
This agent gets the privileges for the current user in the current database.
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();
String user = session.getUserName();
int accPriv = db.queryAccessPrivileges(user);
System.out.println("Privileges for " + user + " in " + title);
// Check each privilege bit to see if it is 0 or 1
if ((accPriv & Database.DBACL_CREATE_DOCS) > 0)
System.out.println("\tCreate documents");
if ((accPriv & Database.DBACL_DELETE_DOCS) > 0)
System.out.println("\tDelete documents");
if ((accPriv & Database.DBACL_CREATE_PRIV_AGENTS) > 0)
System.out.println("\tCreate private agents");
if ((accPriv & Database.DBACL_CREATE_PRIV_FOLDERS_VIEWS) > 0)
System.out.println("\tCreate private folders/views");
if ((accPriv & Database.DBACL_CREATE_SHARED_FOLDERS_VIEWS) > 0)
System.out.println("\tCreate shared folders/views");
if ((accPriv & Database.DBACL_CREATE_SCRIPT_AGENTS) > 0)
System.out.println("\tCreate LotusScript/Java agents");
if ((accPriv & Database.DBACL_READ_PUBLIC_DOCS) > 0)
System.out.println("\tRead public documents");
if ((accPriv & Database.DBACL_WRITE_PUBLIC_DOCS) > 0)
System.out.println("\tWrite public documents");
if ((accPriv & Database.DBACL_REPLICATE_COPY_DOCS) > 0)
System.out.println("\tReplicate or copy documents");
} catch(Exception e) {
e.printStackTrace();
}
}
}