Ejemplo n.º 1
0
 private ConditionalPermissionInfo setConditionalPermissionInfo(
     String name, ConditionInfo[] conds, PermissionInfo[] perms, boolean firstTry) {
   ConditionalPermissionUpdate update = newConditionalPermissionUpdate();
   List rows = update.getConditionalPermissionInfos();
   ConditionalPermissionInfo newInfo =
       newConditionalPermissionInfo(name, conds, perms, ConditionalPermissionInfo.ALLOW);
   int index = -1;
   if (name != null) {
     for (int i = 0; i < rows.size() && index < 0; i++) {
       ConditionalPermissionInfo info = (ConditionalPermissionInfo) rows.get(i);
       if (name.equals(info.getName())) {
         index = i;
       }
     }
   }
   if (index < 0) {
     // must always add to the beginning (bug 303930)
     rows.add(0, newInfo);
     index = 0;
   } else {
     rows.set(index, newInfo);
   }
   synchronized (lock) {
     if (!update.commit()) {
       if (firstTry)
         // try again
         setConditionalPermissionInfo(name, conds, perms, false);
     }
     return condAdminTable.getRow(index);
   }
 }
Ejemplo n.º 2
0
 /** @deprecated */
 public ConditionalPermissionInfo getConditionalPermissionInfo(String name) {
   synchronized (lock) {
     return condAdminTable.getRow(name);
   }
 }