Email Me
my first name at my last name dot com

Archives
Past Blog Entries

Links
Andy Wrenbeck
ApplePhoneShow
Ben Abler
Ben Poole
Bob Lutz
Bob Obringer
Bruce Elgort
Carpeaqua
Codestore
Cult of Mac
Daring Fireball
Detroit News
Domino Unplugged
Ed Brill
Guidebook
I, Cringely
Joe Litton
Jonvon
NSFTools
NSLog
Ned Batchelder
Old Blog
Raymond Chen
Scobleizer Weblog
Techdirt
Unsanity
Weblogs Apple Log
bonj

11/7/07 9:40 AMEnforce Consistent ACL - Code released into the wild

Somebody asked me for this today, since my old domino based blog entries are no longer available online.

Here is the C++ Lotus API code I wrote to toggle the SetUniformAccess flag on a database, also known as the Enforce Consistent ACL flag. This does require the C++ dll on your path, such as lcppn23.dll or later.

#include <lncppapi.h>
#include <iostream.h>

int main(int argc, char *argv[])
{
	char errorBuf[LNERROR_MESSAGE_LENGTH];
	LNNotesSession session;
	LNSetThrowAllErrors(TRUE);

	if ( argc < 2 )
	{
		cout << "This application sets the SetUniformAccess flag" << endl;
		cout << "Also known as the EnforceConsistentACL flag" << endl;
		cout << "Usage: " << endl;
		cout << "     DbSetUniformAccess.exe database flag" << endl;
		cout << "          -database = path to database to change" << endl;
		cout << "          -flag = T to set to true, anything else to set to false" << endl;
		return(0);
	}

	

	try {
		session.Init();
		LNDatabase db;
		LNACL acl;
		char * testchar = "T";

		cout << "Opening database: " << argv[1] << endl;
		session.GetDatabase(argv[1], &db);
		db.Open(LNDBOPENFLAGS_NO_USER_INFO);
		db.GetACL(&acl);

		if (strcmp(argv[2], "T") == 0)
		{
			acl.SetUniformAccess(TRUE);
			cout << "changed SetUniformAccess to TRUE" << endl;
		}
		else
		{
			acl.SetUniformAccess(FALSE);
			cout << "changed SetUniformAccess to FALSE" << endl;
		}

		acl.Save();
	}
	catch (LNSTATUS error) {
		LNGetErrorMessage(error, errorBuf);
		cout << "Error:   " << errorBuf << endl;
	}

	cout << "Finished running" << endl;
	session.Term();
	return(0);
}
      

Ed Wrenbeck // Add a comment // link

Current Articles
Fluorescent Application Download
Implementing a factory pattern in LotusScript
Using AWStats and Tomcat
Using LotusScript to add subforms to a form
Installing FlowBuilder 3.0 on Linux (SuSE 9.1)
NSOutlineView and Tooltips and Java
The technology behind the site
How do I get Pi Messenger?

login