Rinat Enikeev
Rinat Enikeev

Reputation: 1

IBM Filenet: how to check access rights to delete

How to check programmatically if the currently connected user have access rights to delete the folder or a document in content engine object store? Can I do this with folder.getAccessAllowed() method and AccessLevel.* constants? (CE 5.0)

Upvotes: 0

Views: 2561

Answers (2)

Frederic Fortier
Frederic Fortier

Reputation: 750

Here is a way:

int accessAllowed = document.getAccessAllowed();
if (checkRight(accessAllowed, AccessRight.DELETE))
{
    log.trace("Access level "
        + AccessRight.DELETE.toString() + " is present");
}

private boolean checkRight(int rights, AccessRight ar)
{
    return (rights & ar.getValue()) != 0;
}

Upvotes: 0

ᄂ ᄀ
ᄂ ᄀ

Reputation: 5782

AccessLevel is meant to represent a set of individual access rights. To check for specific right you should use something like this:

(object.getAccessAllowed() & AccessRight.DELETE_AS_INT) == AccessRight.DELETE_AS_INT

Upvotes: 2

Related Questions