My Oracle Support Banner

Insufficient Privilege Error Only on Agile SDK Even When Privilege Is Assigned (Doc ID 2216877.1)

Last updated on JULY 18, 2017

Applies to:

Oracle Agile PLM Framework - Version 9.3.3.0 and later
Information in this document applies to any platform.

Symptoms

Actual Behavior
Using AgileAPI, wrote a program to check Change Affected Item Redline BOM and retrieve its BOM child item attribute.
Inside the code, the user is given a role including discovery and read privilege for a particular part object but
Insufficient privilege error occurs. Using the same user, it can browse the BOM child item attributes via web client
without any error. This issue can be workaround using the following code.

System.out.println(bomItem.getRevision());

Error
Exception in thread "main" com.agile.util.exception.CMAppException:
Insufficient privilege.
at weblogic.rjvm.ResponseImpl.unmarshalReturn(ResponceImpl.java : 237)

Steps
1. Create Part object with following :

AN0000200033

2. On AN0000200033 BOM item include item : CH0001000007
3. CH0001000007 is part subclass : recipe

Lifecycle Phase : Tentative
Corporate_Code : XXX
Recipe Division : null

4. Create Criteria : Items-Parts-Recipe_06@XXX

Recipe ( Title Block.Lifecycle Phase In Tentative Or
Title Block.Lifecycle Phase In Pre-Active Or
Title Block.Lifecycle Phase In Active ) And
Page Two.Corporate_Code In XXX And
( Page Three.Recipe Division In FL Or
Page Three.Recipe Division In MR Or
Page Three.Recipe Division In AP Or
Page Three.Recipe Division Is Null )

5. Create following 2 Privilege

Name : Items-Parts-Recipe#Discovery@XXX_06
Prvilege : Discovery
Object Type : Recipe
Privilege Criteria: Items-Parts-Recipe_06@XXX

Name : Items-Parts-Recipe#Read@XXX_06
Prvilege : Read
Object Type : Recipe
Privilege Criteria : Items-Parts-Recipe_06@XXX
Applied To : <-- all attribute

6. Assign role with above criteria

Role : PLM_XXX_FL_GRANT_RECIPE

7. On user : admin , share the role : PLM_XXX_FL_GRANT_RECIPE to user :
testuser01
on CH0001000007

8. On user : admin create ECO: BS0000005780 and on Affected Items tab, add
AN0000200033

9. Switch to user : testuser01 and confirm ECO: BS0000005780 and on affected items tab, select AN0000200033.
Redline BOM tab shows Item numbers and Item Rev.

10. Now run the following agile sdk script

import java.util.Iterator;
import java.util.HashMap;
import com.agile.api.AgileSessionFactory;
import com.agile.api.IAgileSession;
import com.agile.api.ICell;
import com.agile.api.IChange;
import com.agile.api.IItem;
import com.agile.api.IRow;
import com.agile.api.ITable;
import com.agile.api.ItemConstants;
import com.agile.api.ChangeConstants;

public class BOMTestNG {
   public static void main(String[] args) throws Exception {
      HashMap<Integer,String> params = new HashMap<Integer,String>();
      params.put(AgileSessionFactory.USERNAME, "testuser01");
      params.put(AgileSessionFactory.PASSWORD, "xxxxxx");
      AgileSessionFactory instance =AgileSessionFactory.getInstance("http://xxxxxxx:7001/Agile");
      IAgileSession session = instance.createSession(params);
      //
      IChange change = (IChange) session.getObject(IChange.OBJECT_TYPE,"BS0000005780");
      ITable aTable = change.getTable(ChangeConstants.TABLE_AFFECTEDITEMS);
      Iterator aIterator = aTable.iterator();
      while(aIterator.hasNext()) {
         IRow aRow = (IRow) aIterator.next();
         IItem item = (IItem) aRow.getReferent();
         System.out.println("item=" + item.getName());
         if(!item.getName().equals("AN0000200033")) {
            continue;
         }
         ITable table = item.getTable(ItemConstants.TABLE_REDLINEBOM);
         Iterator iterator = table.iterator();
         while(iterator.hasNext()) {
            IRow row = (IRow) iterator.next();
            ICell cell = row.getCell("itemNumber");
            System.out.println(" getCellDiscoveryPrivilege =" +row.getCellDiscoveryPrivilege("itemNumber"));
            System.out.println(" itemNumber=" + cell.getValue());
            IItem bomItem = (IItem) row.getReferent();
            /***************************************/
            // System.out.println(bomItem.getRevision());
            /***************************************/
            System.out.println(" getName()=" + bomItem.getName());
         }  
      }
   }
}

 

11. Error

item=AN0000200029
item=AN0000200033
getCellDiscoveryPrivilege =false
itemNumber=CH0001000007
Exception in thread "main" com.agile.util.exception.CMAppException:
Insufficient privilege.
at weblogic.rjvm.ResponseImpl.unmarshalReturn(ResponseImpl.java:237)
at
weblogic.rmi.cluster.ClusterableRemoteRef.invoke(ClusterableRemoteRef.java:464)
at
weblogic.rmi.cluster.ClusterableRemoteRef.invoke(ClusterableRemoteRef.java:272)
at
com.agile.pc.cmserver.item.ItemSessionBean_v9sfth_EOImpl_1211_WLStub.loadTable(Unknown Source)

...

12. If comment out System.out.println(bomItem.getRevision()); the error does not occur

import java.util.Iterator;
import java.util.HashMap;
import com.agile.api.AgileSessionFactory;
import com.agile.api.IAgileSession;
import com.agile.api.ICell;
import com.agile.api.IChange;
import com.agile.api.IItem;
import com.agile.api.IRow;
import com.agile.api.ITable;
import com.agile.api.ItemConstants;
import com.agile.api.ChangeConstants;

public class BOMTestNG {
   public static void main(String[] args) throws Exception {
      HashMap<Integer,String> params = new HashMap<Integer,String>();
      params.put(AgileSessionFactory.USERNAME, "testuser01");
      params.put(AgileSessionFactory.PASSWORD, "xxxxxx");
      AgileSessionFactory instance =AgileSessionFactory.getInstance("http://xxxxxxx:7001/Agile");
      IAgileSession session = instance.createSession(params);
      //
      IChange change = (IChange) session.getObject(IChange.OBJECT_TYPE,"BS0000005780");
      ITable aTable = change.getTable(ChangeConstants.TABLE_AFFECTEDITEMS);
      Iterator aIterator = aTable.iterator();
      while(aIterator.hasNext()) {
         IRow aRow = (IRow) aIterator.next();
         IItem item = (IItem) aRow.getReferent();
         System.out.println("item=" + item.getName());
         if(!item.getName().equals("AN0000200033")) {
            continue;
         }
         ITable table = item.getTable(ItemConstants.TABLE_REDLINEBOM);
         Iterator iterator = table.iterator();
         while(iterator.hasNext()) {
            IRow row = (IRow) iterator.next();
            ICell cell = row.getCell("itemNumber");
            System.out.println(" getCellDiscoveryPrivilege =" +row.getCellDiscoveryPrivilege("itemNumber"));
            System.out.println(" itemNumber=" + cell.getValue());
            IItem bomItem = (IItem) row.getReferent();
            /***************************************/
            System.out.println(bomItem.getRevision());
            /***************************************/
            System.out.println(" getName()=" + bomItem.getName());
         }  
      }
   }
}

 

 

Cause

To view full details, sign in with your My Oracle Support account.

Don't have a My Oracle Support account? Click to get started!


In this Document
Symptoms
Cause
Solution
References


My Oracle Support provides customers with access to over a million knowledge articles and a vibrant support community of peers and Oracle experts.