Setting the role also requires retrieving the ObjectPrincipal. See Retrieving and adding the ObjectPrincipal. Once you have the ObjectPrincipal, you can set the role and commit your changes. For example:
Reports = IStore.Query("Select SI_ID From CI_INFOOBJECTS Where SI_ID="+ReportID);
SecurityInfo = Report.SecurityInfo;
Principal = SecurityInfo.ObjectPrincipals.Item("#"+UserID);
Principal = SecurityInfo.ObjectPrincipals.Add(UserID);
Principal.Role = ceRoleNoAccess;
Note: When you set a role on something other than ceRoleAdvanced (which means that you have to set rights individually), both AdvancedInheritFolders and AdvancedInheritGroups are cleared.
Crystal Decisions, Inc. http://www.crystaldecisions.com Support services: http://support.crystaldecisions.com |