Nirali Sanura
Nirali Sanura

Reputation: 27

setCanDeleteDocuments() Lotus Notes ACL

I am trying to delete document,where conditions is...

Where the user is in Group and having the deletion rights & every users in group is able to delete the document.

But problem is when, If the name I specify is also listed explicitly in the ACL and does not have deletion rights.Then it does not check the group rights which is fair enough.

For that i am trying to give deletion rights to those users who are in group by code given below.

var acl:NotesACL=database.getACL();
var entry:NotesACLEntry=acl.getFirstEntry();
if(entry!=null)
{
var user:NotesACLEntry=acl.getEntry(@UserName());
if(user.isCanDeleteDocuments()==false)
{
user.setCanDeleteDocuments(true);
acl.save();
}
}

Where it shows error like, Exception occurred calling method NotesACL.save() null.

Even explicitly added user is having user type=person & Access= Manager in ACL.

is there any other way to do this?

Any help would be appreciated. Thanks in advance.

Upvotes: 0

Views: 97

Answers (1)

Paul Stephen Withers
Paul Stephen Withers

Reputation: 15729

Using database as a starting point means you're getting the database as the user. Unless the user already has Manager access to the database, this will fail because the user doesn't have access to update the ACL.

You can use sessionAsSigner, but bear in mind you cannot use the getCurrentDatabase() method. Instead you must use the getDatabase(server,filePath) method in order to get the database with the signer authority. Obviously the signer also needs rights to modify the ACL.

Upvotes: 3

Related Questions