public static void createRealmPrivileges(SSOToken token,String realmName) throws SSOException, DelegationException {
  String realmId=DNMapper.orgNameToDN(realmName);
  DelegationManager dm=new DelegationManager(token,realmName);
  Set privs=dm.getConfiguredPrivilegeNames();
  if ((privs == null) || privs.isEmpty()) {
    return;
  }
  if (debug.messageEnabled()) {
    debug.message("DelegationUtils:Getting global privileges");
  }
  Iterator it=privs.iterator();
  while (it.hasNext()) {
    ServiceConfig perm=null;
    String privName=(String)it.next();
    if (getRevisionNumber() == AM70_DELEGATION_REVISION) {
      perm=DelegationUtils.getPermissionConfig(null,privName,true);
    }
 else {
      perm=DelegationUtils.getPrivilegeConfig(null,privName,true);
    }
    Map attrs=perm.getAttributes();
    if ((attrs == null) || attrs.isEmpty()) {
      throw new DelegationException(ResBundleUtils.rbName,"get_privilege_attrs_failed",null,null);
    }
    Set subjects=null;
    Set configSubjects=(Set)attrs.get(SUBJECTS_IN_LEGACY_MODE);
    if ((configSubjects != null) && (!configSubjects.isEmpty())) {
      Iterator sIter=configSubjects.iterator();
      subjects=new HashSet();
      while (sIter.hasNext()) {
        String sv=(String)sIter.next();
        subjects.add(swapRealmTag(realmId,sv));
      }
    }
    DelegationPrivilege priv=new DelegationPrivilege(privName,subjects,realmName);
    dm.addPrivilege(priv);
    if (debug.messageEnabled()) {
      debug.message("added " + privName + " privilege in realm "+ realmName);
    }
  }
}

public static void createRealmPrivileges ( SSOToken token , String realmName ) throws SSOException , DelegationException { String realmId = DNMapper . orgNameToDN ( realmName ) ; DelegationManager dm = new DelegationManager ( token , realmName ) ; Set privs = dm . getConfiguredPrivilegeNames ( ) ; if ( ( privs == null ) || privs . isEmpty ( ) ) { return ; } if ( debug . messageEnabled ( ) ) { debug . message ( "DelegationUtils:Getting global privileges" ) ; } Iterator it = privs . iterator ( ) ; while ( it . hasNext ( ) ) { ServiceConfig perm = null ; String privName = ( String ) it . next ( ) ; if ( getRevisionNumber ( ) == AM70_DELEGATION_REVISION ) { perm = DelegationUtils . getPermissionConfig ( null , privName , true ) ; } else { perm = DelegationUtils . getPrivilegeConfig ( null , privName , true ) ; } Map attrs = perm . getAttributes ( ) ; if ( ( attrs == null ) || attrs . isEmpty ( ) ) { throw new DelegationException ( ResBundleUtils . rbName , "get_privilege_attrs_failed" , null , null ) ; } Set subjects = null ; Set configSubjects = ( Set ) attrs . get ( SUBJECTS_IN_LEGACY_MODE ) ; if ( ( configSubjects != null ) && ( ! configSubjects . isEmpty ( ) ) ) { Iterator sIter = configSubjects . iterator ( ) ; subjects = new HashSet ( ) ; while ( sIter . hasNext ( ) ) { String sv = ( String ) sIter . next ( ) ; subjects . add ( swapRealmTag ( realmId , sv ) ) ; } } DelegationPrivilege priv = new DelegationPrivilege ( privName , subjects , realmName ) ; dm . addPrivilege ( priv ) ; if ( debug . messageEnabled ( ) ) { debug . message ( "added " + privName + " privilege in realm " + realmName ) ; } } }
creates default privileges for a newly created realm this method should be called in legacy mode only .
