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);
}