Setting the role

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);


Report = Reports.Item(1);

SecurityInfo = Report.SecurityInfo;

try {

    Principal =  SecurityInfo.ObjectPrincipals.Item("#"+UserID);

}

catch(e) {

    Principal = SecurityInfo.ObjectPrincipals.Add(UserID);

}

var ceRoleNoAccess=1;

Principal.Role = ceRoleNoAccess;

IStore.Commit(Reports);

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.

Go to:



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