本文整理汇总了Java中lotus.domino.Database.getACL方法的典型用法代码示例。如果您正苦于以下问题:Java Database.getACL方法的具体用法?Java Database.getACL怎么用?Java Database.getACL使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类lotus.domino.Database
的用法示例。
在下文中一共展示了Database.getACL方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addImpl
import lotus.domino.Database; //导入方法依赖的package包/类
/**
* Does most of the work of creating a delegate.
*
* <p>This version edits the ACL directly. A subclass may use adminp
* to createe the delegate.
*
* @param database
* @param delegate
* @throws ModelException
* @throws NotesException
*/
protected void addImpl(Database database, Delegate delegate, Document profile) throws ModelException, NotesException {
ACL acl = null;
try {
if ( !hasManagerAccess(database) ) {
throw new ModelException("Manager access is required to add a delegate.", ModelException.ERR_NOT_ALLOWED); // $NLX-DelegateProvider.Manageraccessisrequiredtoaddadele-1$
}
acl = database.getACL();
String delegateName = delegate.getName();
// Check for conflicts
ACLEntry entry = acl.getFirstEntry();
while ( entry != null ) {
Name no = entry.getNameObject();
if ( delegateName.equalsIgnoreCase(no.getAbbreviated()) ) {
throw new ModelException("A delegate of that name already exists", ModelException.ERR_CONFLICT); // $NLX-DelegateProvider.Adelegateofthatnamealreadyexists-1$
}
entry = acl.getNextEntry();
}
// Create the new entry
entry = acl.createACLEntry(delegateName, ACL.LEVEL_NOACCESS);
aclEntryFromDelegate(delegate, entry);
acl.save();
}
finally {
BackendUtil.safeRecycle(acl);
}
}
示例2: setImpl
import lotus.domino.Database; //导入方法依赖的package包/类
/**
* Does most of the work of updating a delegate.
*
* <p>This version edits the ACL directly. A subclass may use adminp
* to update the delegate.
*
* @param database
* @param delegate
* @throws ModelException
* @throws NotesException
*/
protected void setImpl(Database database, Delegate delegate, Document profile) throws ModelException, NotesException {
ACL acl = null;
try {
if ( !hasManagerAccess(database) ) {
throw new ModelException("Manager access is required to modify a delegate.", ModelException.ERR_NOT_ALLOWED); // $NLX-DelegateProvider.Manageraccessisrequiredtomodifyad-1$
}
acl = database.getACL();
// Find the matching delegate
boolean updated = false;
ACLEntry entry = acl.getFirstEntry();
while ( entry != null ) {
Name no = entry.getNameObject();
if ( delegate.getName().equalsIgnoreCase(no.getAbbreviated()) ) {
// Clear the current access
entry.setLevel(ACL.LEVEL_NOACCESS);
entry.setPublicReader(false);
entry.setPublicWriter(false);
// Apply the new access
aclEntryFromDelegate(delegate, entry);
acl.save();
updated = true;
break;
}
entry = acl.getNextEntry();
}
if ( !updated ) {
throw new ModelException("Delegate not found", ModelException.ERR_NOT_FOUND); // $NLX-DelegateProvider.Delegatenotfound-1$
}
}
finally {
BackendUtil.safeRecycle(acl);
}
}
示例3: deleteImpl
import lotus.domino.Database; //导入方法依赖的package包/类
/**
* Does most of the work of deleting a delegate.
*
* <p>This version edits the ACL directly. A subclass may use adminp
* to delete the delegate.
*
* @param database
* @param name The abbreviated name of the delegate to delete.
* @param owner The canonical name of the mail file owner.
* @throws ModelException
* @throws NotesException
*/
protected void deleteImpl(Database database, String name, Document profile) throws ModelException, NotesException {
ACL acl = null;
try {
if ( !hasManagerAccess(database) ) {
throw new ModelException("Manager access is required to remove a delegate.", ModelException.ERR_NOT_ALLOWED); // $NLX-DelegateProvider.Manageraccessisrequiredtoremovead-1$
}
// Get the ACL
acl = database.getACL();
boolean deleted = false;
ACLEntry entry = acl.getFirstEntry();
// Get the owner of the mailfile
String owner = profile.getItemValueString(OWNER_ITEM);
// Look at each ACL entry
while ( entry != null ) {
Name no = entry.getNameObject();
// If it's a match, delete it
if ( name.equalsIgnoreCase(no.getAbbreviated()) ) {
// But you can't remove the owner's access
if ( owner != null && owner.equalsIgnoreCase(entry.getName()) ) {
throw new ModelException("Cannot remove the owner's access", ModelException.ERR_NOT_ALLOWED); // $NLX-DelegateProvider.Cannotremovetheownersaccess-1$
}
// It's gone
acl.removeACLEntry(name);
acl.save();
deleted = true;
break;
}
entry = acl.getNextEntry();
}
if ( !deleted ) {
throw new ModelException("Delegate not found", ModelException.ERR_NOT_FOUND); // $NLX-DelegateProvider.Delegatenotfound.1-1$
}
}
finally {
BackendUtil.safeRecycle(acl);
}
}
示例4: getDelegatesFromAcl
import lotus.domino.Database; //导入方法依赖的package包/类
/**
* Reads the list of delegates from the ACL.
*
* <p>We don't use this code anymore, but it's kept here for
* sentimental reasons.
*
* @param database
* @return
* @throws NotesException
*/
private List<Delegate> getDelegatesFromAcl(Database database) throws NotesException {
List<Delegate> delegates = new ArrayList<Delegate>();
ACL acl = null;
Document profile = null;
try {
// Get the owner of the mailfile
profile = profileGet(database);
String owner = profile.getItemValueString(OWNER_ITEM);
// Get the ACL
acl = database.getACL();
ACLEntry entry = acl.getFirstEntry();
// Convert each ACL entry to a delegate
while ( entry != null ) {
Delegate delegate = null;
// Convert entry to delegate, unless this is the owner of the mail file
if ( owner == null || !owner.equalsIgnoreCase(entry.getName()) ) {
delegate = getDelegateFromAclEntry(entry);
}
// Add the delegate to the list
if ( delegate != null ) {
delegates.add(delegate);
}
entry = acl.getNextEntry();
}
}
finally {
BackendUtil.safeRecycle(acl);
BackendUtil.safeRecycle(profile);
}
return delegates;
}