COGNOiSe.com - The IBM Cognos Community

IBM Cognos 8 Platform => COGNOS 8 => SDK => Topic started by: clowicek on 14 Jun 2012 09:40:06 AM

Title: Show permission on package
Post by: clowicek on 14 Jun 2012 09:40:06 AM
Hello,
i have question about show permission on package... i have java sdk application that show me all package on public folder... and now i need show package name and permission information (user/group/role and permission - Read/Write etc). I don't know how show permission information... can you help me :)

Thank you

Stepan
Title: Re: Show permission on package
Post by: murali999 on 20 Jun 2012 06:04:36 AM
Hi Stepan,

Try the below code it will give you the all accesspermissions assigned to the object

BaseClass [] package = cmService.query(); // Query method for getting the package
Policy[] existingPolicie = packages[0].getPolicies().getValue();
for(int j=0;j<existingPolicies.length;j++)
{
Permission[] p=existingPolicies[j].getPermissions();

PropEnum[] props2 = new PropEnum[] {PropEnum.searchPath, PropEnum.defaultName };
SearchPathMultipleObject spmo2 = new SearchPathMultipleObject();
spmo2.set_value(existingPolicies[j].getSecurityObject().getSearchPath().getValue());

BaseClass[] secobj = cmService.query(spmo2, props2, sort,QueryOptions);

if(secobj !=null && secobj.length>0)
{
           System.out.println(
                             secobj[0].getDefaultName().getValue() +" has the below access permissions");

         for(int k=0;k<p.length;k++)
        {
                               System.out.print(p[k].getName() +"  : ");
                               System.out.println(p[k].getAccess());
                      }
             }
}


Regards,
Murali

RA:
Placed code between code-tags.