FileNet Content Services
Java Connector v3.0

com.filenet.wcm.api
Interface Permissions

All Superinterfaces:
java.util.Collection, java.util.List, java.io.Serializable

public interface Permissions
extends java.util.List, java.io.Serializable

A Permissions collection contains one or more com.filenet.Panagon.Permission objects. Each Permission object represents the type of access to resources that a user or group is allowed or denied. This release of the Content Services Java Connector allows you to set or retrieve access rights to Document and Folder objects.

You can perform actions on the collection such as adding or removing elements, iterating through the collection, or reordering the position of elements. You can persist a new or modified Permissions collection to the Content Services server.

To add access rights an object to be created, create an empty Permissions collection with the ObjectFactory interface's getPermissions method, create Permission objects with one of the ObjectFactory's getPermission methods, and add the Permission objects to the Permissions collection. You can pass the Permissions collection to the createObject method on an ObjectStore object. Or you can pass the Permissions collection to the addSubFolder method on a Folder object. This action sets the permissions for the newly-created object and persists its Permissions collection to the Content Services server.

Access rights to objects, such as documents and folders, are granted or denied to users or groups (the "grantees") by adding and removing Permission objects from a Permissions collection. The Permissions collection represents all the access rights granted or denied to the named grantees.

To add to the access rights of an object, retrieve the object's Permission collection, create a Permission object containing the appropriate information, and add the new Permission object to the Permissions collection. Then, save the Permissions collection on the object in question by calling setPermissions. To remove access rights from an object, retrieve the Permissions collection of the object, remove the relevant Permission object from the collection, and save the modified collection.

The following code fragment retrieves a Permissions collection for a previously-defined Folder object (fldr) and adds two Permission objects--one for a user and another for a group of users.

 Permissions permColl = fldr.getPermissions();
 Permission perm =
    ObjectFactory.getPermission(Permission.RIGHT_READ | Permission.RIGHT_LINK,
    Permission.TYPE_ALLOW,"TesterA", BaseObject.TYPE_USER);
 permColl.add(perm);
 //reuse Permission object for the next addition
 perm = ObjectFactory.getPermission(Permission.LEVEL_FULL_CONTROL_FOLDER,
    Permission.TYPE_ALLOW,"TesterGroup", BaseObject.TYPE_GROUP);
 permColl.add(perm);
 fldr.setPermissions(permColl);//save updates to Permissions collection

The setPermissions() method persists the permissions information to the Folder object's Permissions collection. Unlike other methods, such as setProperties(), that replace only the changed elements of a collection, setPermissions() completely replaces the existing Permissions collection on an object.

See Also:
CS Java Toolkit Developer's Guide

Method Summary
 int asMask()
          

Not Implemented in CS Java Connector v3.0.

 
Methods inherited from interface java.util.List
add, add, addAll, addAll, clear, contains, containsAll, equals, get, hashCode, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, retainAll, set, size, subList, toArray, toArray
 

Method Detail

asMask

public int asMask()

Not Implemented in CS Java Connector v3.0.

Returns an integer value that represents a consolidation of access rights and levels contained in the Permissions collection. You can use the returned integer as a bitmask with traditional Boolean logic in combination with the access rights and levels defined in the Permission interface.

Although this method works with any Permissions collection, its most useful application is with the results of a call to an object's getUserAccess method. All permission descriptions in the collection returned by getUserAccess are applicable to a given user, whereas, in general, elements of a Permissions collection that is returned by other methods describe the access rights of a mixture of users and/or groups.

The following code fragment illustrates how you can use the returned integer to determine if a given user has the appropriate access rights to create a new version of the document's content:

Document doc = ...;
 int docMask = doc.getUserAccess().asMask();
 if ((docMask & Permission.RIGHT_VERSION) == 0)
 {
    // User does not have the right to version the document
    ...;
 }

Returns:
An integer reflecting the consolidation of access rights and access levels on the object.

FileNet Content Services
Java Connector v3.0