The model
Each instance of AbtLnDatabase has a lazy initializing access control list. If you use the accessControlList method, the ACL will be initialized on the fly. Any changes to the ACL will only become persistent if you send the store message to the AbtLnAccessControlList instance. The class AbtLnAccessControlList essentially controls two ordered collections to handle ACL entries and to maintain valid role names.
Send the entries message to an AbtLnAccessControlList instance to receive the collection of all AbtLnACLEntry objects for a database. AbtLnACLEntry is a class that models the access rights for a person, group, or server. Besides methods to set and read all regular access levels (like Manager or Designer) there is a variety of messages to add further restrictions. Use the roles method to find out about defined roles for a database and use the addRole: protocol to create new roles. Access roles are referenced by their names.
Here is a step-by-step example showing how to manipulate the access control list in one of the demo databases supplied with Domino Connection.
Note:
Be aware that changing access control settings on a database located on a server might cause problems when you change your own access level.
 
| localConnection database acl |
"Startup runtime system"
AbtLnEnvironment startUp.
"Open a connection to local databases"
localConnection := AbtLnConnection local.
"Open one of the sample databases provided with the feature"
database := localConnection openDatabase: 'VASAMPLE\VASAMPLE'.
"Read the sample database's access control list"
acl := database accessControlList.
"Display some properties of each ACL entry on the Transcript window"
acl entries do: :entry |
Transcript nextPutAll: entry printString; cr.
Transcript nextPutAll: entry accessLevelName; cr.
Transcript nextPutAll: 'canCreateDocuments: ', entry canCreateDocuments
printString; cr.
Transcript nextPutAll: 'canDeleteDocuments: ', entry canDeleteDocuments
printString; cr.
].
"Add an new entry to the ACL"
acl addNewEntryNamed: 'TestUser'.
"Set the new entry's access level to 'No Access'"
(acl entryNamed: 'TestUser') setToNoAccess.
"Store the ACL"
acl store.
"Close the database"
database close.
"Shutdown runtime system"
AbtLnEnvironment shutDown.
Last modified date: 01/29/2015