Retrieving rights

The central point from which you access security information on an InfoObject is from the SecurityInfo property of the InfoObject. It is from this property that you gain access to the user's rights.

To retrieve the rights for a user
  1. Retrieve the ObjectPrincipal from InfoObject.SecurityInfo.ObjectPrincipals using the ID of the user. This was demonstrated above.

    If the ObjectPrincipal object for the user does not exist in the ObjectPrincipals collection, then the user has no explicit rights to the object. However, if the user is a member of a group that has rights to the object, the user will still have rights from that group and you need to use AnyPrincipal to retrieve the ObjectPrincipal.

  2. Using the ObjectPrincipal, you iterate through all the known rights of the object. Once you have the ID of the right from SecurityInfo.KnownRights, you use this ID to check if the user has been granted the right in ObjectPrincipal.Rights.

    The right that you try to retrieve may or may not exist. Depending on whether it exists or not, whether or not the inheritance flags are set, and whether or not the right is granted, you may have to check the inherited rights as well. Use the following flow chart to determine how to retrieve the net right for an object.

The following examples illustrate this in more detail.

Go to the next section: Checking the known rights against the principal's rights.



Crystal Decisions, Inc.
http://www.crystaldecisions.com
Support services:
http://support.crystaldecisions.com