ACLPrint - Utility to Print Out the ACL

While writing a test plan I found it necessary to have this Agent that prints (to a DOS-type text file) most of what is accessible in the ACL: (of course, Design Synopsis does it better)

import lotus.domino.*;

import java.util.Vector;

public class JavaAgent extends AgentBase {

public void NotesMain() {



	try {

		Session session = getSession();

		AgentContext agentContext = session.getAgentContext();

		lotus.domino.Database db = agentContext.getCurrentDatabase();

		lotus.domino.ACL acl = db.getACL();

		lotus.domino.Stream outStream = session.createStream();

		lotus.domino.ACLEntry aclEntry = acl.getFirstEntry();



  		if (outStream.open("C:\\temp\\textout.txt")) {

  			// File must be empty!!

    			if (outStream.getBytes() == 0) {

				// Loop over all the name entries

    				do {

       				//Write the name and access level

       				int iType = aclEntry.getUserType();

					String strName = aclEntry.getName();

					String strType;

					switch (iType) {

       					case ACLEntry.TYPE_MIXED_GROUP:  	strType = "Mixed Group"; 	break;

       					case ACLEntry.TYPE_PERSON:  			strType = "Person"; 			break;

       					case ACLEntry.TYPE_PERSON_GROUP:  strType = "Person Group"; break;

       					case ACLEntry.TYPE_SERVER_GROUP:  strType = "Server Group"; break;

       					case ACLEntry.TYPE_SERVER:  			strType = "Server"; 			break;

       					case ACLEntry.TYPE_UNSPECIFIED:  		strType = "Unspecified"; 	break;

       					default: 	strType = "??TYPE NOT HANDLED BY THIS PROGRAM??";

				     }

     					outStream.writeText( strName + " is type " + strType, Stream.EOL_CRLF );

      				// write the access level

      				int iLevel = aclEntry.getLevel();

      				String strLevel;

      				switch (iLevel) {

      					case ACL.LEVEL_NOACCESS: 	strLevel = "No Access"; break;

      					case ACL.LEVEL_DEPOSITOR: strLevel = "Depositor"; 	break;

						case ACL.LEVEL_READER:		strLevel = "Reader"; 		break;

						case ACL.LEVEL_AUTHOR:		strLevel = "Author"; 		break;

						case ACL.LEVEL_EDITOR:		strLevel = "Editor"; 		break;

						case ACL.LEVEL_DESIGNER:	strLevel = "Designer"; 	break;

						case ACL.LEVEL_MANAGER:	strLevel = "Manager"; 	break;

       					default: 	strLevel = "??ACCESS-LEVEL NOT HANDLED BY THIS PROGRAM??";

				     }

     					outStream.writeText( "   Has access level " + strLevel, Stream.EOL_CRLF );

     					

      				// Write the roles

      				Vector roles = aclEntry.getRoles();

      				if (roles.size() == 0) 

      					outStream.writeText( "   Has no roles.");

       				else {

       					outStream.writeText( "   Has roles:  " );

      					for (int i=0; i<roles.size(); i++)

       						outStream.writeText("  " + roles.elementAt(i)); 

       				}

       				outStream.writeText( ". ", Stream.EOL_CRLF );

					

       				// Write the additional access options

       				if (iLevel == ACL.LEVEL_DEPOSITOR || iLevel == ACL.LEVEL_READER )

       				{	

       					if (aclEntry.isPublicReader())

       						outStream.writeText("   Public Reader : YES", Stream.EOL_CRLF );

       					else

       						outStream.writeText("   Public Reader : NO", Stream.EOL_CRLF );

       				}	

            				if (iLevel == ACL.LEVEL_READER)

       				{

       					if (aclEntry.isCanCreateLSOrJavaAgent())

       						outStream.writeText("   Create LS or Java Agents: YES", Stream.EOL_CRLF );

       					else

       						outStream.writeText("   Create LS or Java Agents: NO", Stream.EOL_CRLF );

       				}	

       				if (iLevel == ACL.LEVEL_DEPOSITOR || iLevel == ACL.LEVEL_READER || iLevel == ACL.LEVEL_AUTHOR)

       				{	

       					if (aclEntry.isPublicWriter())

       						outStream.writeText("   Public Writer : YES", Stream.EOL_CRLF );

       					else

       						outStream.writeText("   Public Writer : NO", Stream.EOL_CRLF );

       				}	

            				if (iLevel == ACL.LEVEL_READER)

       				{

       					if (aclEntry.isCanCreateLSOrJavaAgent())

       						outStream.writeText("   Create LS or Java Agents: YES", Stream.EOL_CRLF );

       					else

       						outStream.writeText("   Create LS or Java Agents: NO", Stream.EOL_CRLF );

       				}	

       				if (iLevel == ACL.LEVEL_AUTHOR)

       				{

       					if (aclEntry.isCanCreateDocuments())

       						outStream.writeText("   Create Documents: YES", Stream.EOL_CRLF );

       					else

       						outStream.writeText("   Create Documents: NO", Stream.EOL_CRLF );

       				}	

       				if (iLevel == ACL.LEVEL_AUTHOR || iLevel == ACL.LEVEL_READER || iLevel == ACL.LEVEL_EDITOR ) 

       				{

       					if (aclEntry.isCanCreatePersonalAgent())

       						outStream.writeText("   Create Personal Agents: YES", Stream.EOL_CRLF );

       					else

       						outStream.writeText("   Create Personal Agents: NO", Stream.EOL_CRLF );

         					if (aclEntry.isCanCreatePersonalFolder())

       						outStream.writeText("   Create Personal Folders: YES", Stream.EOL_CRLF );

       					else

       						outStream.writeText("   Create Personal Folders: NO", Stream.EOL_CRLF );

       				}	

       				if (iLevel == ACL.LEVEL_EDITOR)

       				{

       					if (aclEntry.isCanCreateSharedFolder())

       						outStream.writeText("   Create Shared Folders: YES", Stream.EOL_CRLF );

       					else

       						outStream.writeText("   Create Shared Folders: NO", Stream.EOL_CRLF );

       				}	

         				if (	iLevel == ACL.LEVEL_AUTHOR || iLevel == ACL.LEVEL_EDITOR || iLevel == ACL.LEVEL_DESIGNER || iLevel == ACL.LEVEL_MANAGER ) 

       				{

       					if (aclEntry.isCanDeleteDocuments())

       						outStream.writeText("   Delete Documents: YES", Stream.EOL_CRLF );

       					else

       						outStream.writeText("   Create Shared Folders: NO", Stream.EOL_CRLF );

       				}

     					if (iLevel == ACL.LEVEL_READER || iLevel == ACL.LEVEL_AUTHOR || iLevel == ACL.LEVEL_EDITOR || iLevel == ACL.LEVEL_DESIGNER || iLevel == ACL.LEVEL_MANAGER ) 

       				{

       					if (aclEntry.isCanReplicateOrCopyDocuments())

       						outStream.writeText("   Replicate or Copy Docs: YES", Stream.EOL_CRLF );

       					else

       						outStream.writeText("   Replicate or Copy Docs: NO", Stream.EOL_CRLF );

       				}

 				}

				// bottom of the do-while loop over all entries

    				while ( (aclEntry = acl.getNextEntry(aclEntry) ) != null );

    				

    				// List all the roles in the ACL ??

    				

      			outStream.close();

			} 

			else {

				System.out.println("temp\\textout.text is not empty!");

			}

		}	

		else {

			System.out.println("Cannnot open temp\\textout.text");

		}

	} catch(NotesException e) {

		e.printStackTrace();

	} catch(Exception e) {

		e.printStackTrace();

	}

}

}

Subject: ACLPrint - effective rights

We sell a reportpack for Administrators, that includes a report to excel, showing something similar. A big advantage of the ready made report is that it also lists the ‘effective right’ of a person in the databases and what causes that right…

So, what is the highest level of rights that somebody has, and what group, subgroup (or any nested group) or if directly mentioned in the ACL, what caused that level of access.

Have a look at www.integrareports.com and read all about the Integra for Domino Administrators