If you are unable to create a new account, please email support@bspsoftware.com

 

News:

MetaManager - Administrative Tools for IBM Cognos
Pricing starting at $2,100
Download Now    Learn More

Main Menu

Getting Permissions for Roles

Started by mattsalyards, 10 Jan 2007 10:08:05 AM

Previous topic - Next topic

mattsalyards

Hello all.

I need to discover what packages and/or folders a given role has access to, and what those accesses are.  Any thoughts on the best way to accomplish this?

I have tried getting both the base class folders and packages, but there are no permissions returned by the getPermissions() method.  I believe I am looking in the wrong place, but I don't know where the right place is.  I also tried starting with a role, but I don't see how to find the accessible folders/packages for a given role.

I am using Java but any language example will help.

Thank you very much for your ideas.

Regards,
Matt

avitabj

Hi!  I create an extract file every night with the content item name, it's search path, the group/role that has access to the item and the permissions.  Here's a code fragment that works for me
hth..jean

      contentPath="/content//*[@objectClass!='reportHistory' and @objectClass!='output' and @objectClass!='reportVersion'";
      PropEnum props[] = new PropEnum[]{PropEnum.searchPath,
                                PropEnum.objectClass,
                                PropEnum.defaultName};
      try
      {
         BaseClass[] bc = oCrn.query(contentPath, props, new Sort[]{}, new QueryOptions());

         for (int i = 0; i < bc.length; i++)
         {
            PropEnum contentProps[] = new PropEnum[]{PropEnum.searchPath,
                                           PropEnum.defaultName,
                                           PropEnum.objectClass,
                                           PropEnum.policies};

            try
            {
               BaseClass[] contentItem = oCrn.query(bc.getSearchPath().getValue(), contentProps, new Sort[]{}, new QueryOptions() );
               
               PolicyArrayProp existingPols = contentItem[0].getPolicies();

               Policy tmpPols[] = new Policy[existingPols.getValue().length];
               policyCt = 0;

               for (int j = 0; j < existingPols.getValue().length; j ++)
               {
                  Policy policy = existingPols.getValue()[j];

                  permList = null;
                  Permission tmpPerm[] = new Permission[policy.getPermissions().length];
                  Permission currPerm = new Permission();
                  for (int p = 0; p < policy.getPermissions().length; p++)
                  {
                     currPerm = policy.getPermissions()[p];
                     if (p == 0)
                     {
                        permList = tabChar + currPerm.getName();
                     }
                     else
                     {
                        permList = permList + tabChar + currPerm.getName();
                     }
                  }

                  userSearch = policy.getSecurityObject().getSearchPath().getValue();

                  PropEnum userProps[] = new PropEnum[]{PropEnum.searchPath,
                              PropEnum.defaultName,
                              PropEnum.userName};
   
                  try
                  {
                     BaseClass[] users = oCrn.query(userSearch, userProps, new Sort[]{}, new QueryOptions());

                     if (users != null && users.length > 0)
                     {
                        //   you'll need to define your Buffered Writer somewhere
                        bw.write(contentItem[0].getDefaultName().getValue() + tabChar + contentItem[0].getSearchPath().getValue() + tabChar + users[0].getDefaultName().getValue() + tabChar + users[0].getSearchPath().getValue() + permList  );
                        bw.newLine();
                     }
                     ........