question: public static void copyRealmPrivilegesFromParent ( SSOToken token , OrganizationConfigManager parent , OrganizationConfigManager child ) throws SSOException , DelegationException { if ( debug . messageEnabled ( ) ) { debug . message ( "DelegationUtils.copyRealmPrivilegesFromParent" + " Parent org: " + parent . getOrganizationName ( ) + " Child org: " + child . getOrganizationName ( ) ) ; } DelegationManager pdm = new DelegationManager ( token , parent . getOrganizationName ( ) ) ; DelegationManager cdm = new DelegationManager ( token , child . getOrganizationName ( ) ) ; String childOrgName = DNMapper . orgNameToDN ( child . getOrganizationName ( ) ) ; Set pdps = pdm . getPrivileges ( ) ; if ( pdps == null || pdps . isEmpty ( ) ) { if ( debug . messageEnabled ( ) ) { debug . message ( "DelegationUtils.copyRealmPrivileges" + "FromParent: No privilege subjects in parent" ) ; } return ; } for ( Iterator items = pdps . iterator ( ) ; items . hasNext ( ) ; ) { DelegationPrivilege dp = ( DelegationPrivilege ) items . next ( ) ; Set subjects = dp . getSubjects ( ) ; if ( subjects == null || subjects . isEmpty ( ) ) { if ( debug . messageEnabled ( ) ) { debug . message ( "DelegationUtils.copyRealmPrivileges" + "FromParent: No subjects in privilege: " + dp ) ; } continue ; } Set newSubjects = new HashSet ( ) ; for ( Iterator subs = subjects . iterator ( ) ; subs . hasNext ( ) ; ) { String sName = ( String ) subs . next ( ) ; try { AMIdentity id = IdUtils . getIdentity ( token , sName ) ; AMIdentity newId = new AMIdentity ( token , id . getName ( ) , id . getType ( ) , childOrgName , id . getDN ( ) ) ; newSubjects . add ( IdUtils . getUniversalId ( newId ) ) ; } catch ( IdRepoException ide ) { if ( debug . messageEnabled ( ) ) { debug . message ( "DelegationUtils.copyRealmPrivileges" + "FromParent: IdRepoException for: " + dp , ide ) ; } continue ; } } dp . setSubjects ( newSubjects ) ; Set permissions = dp . getPermissions ( ) ; if ( ( permissions != null ) && ( ! permissions . isEmpty ( ) ) ) { Iterator it = permissions . iterator ( ) ; while ( it . hasNext ( ) ) { DelegationPermission perm = ( DelegationPermission ) it . next ( ) ; perm . setOrganizationName ( "*" + childOrgName ) ; } } cdm . addPrivilege ( dp ) ; if ( debug . messageEnabled ( ) ) { debug . message ( "DelegationUtils.copyRealmPrivileges" + "FromParent: Privilege copied from parent: " + dp ) ; } } }
target:  Creates default privileges for a newly created realm This method should  be called in realm mode only.