private static void createAdminPrivilegeEntity(PrivilegeEntity entity) {
    PermissionEntity pe = new PermissionEntity();
    pe.setId(PermissionEntity.AMBARI_ADMINISTRATOR_PERMISSION);
    pe.setPermissionName(PermissionEntity.AMBARI_ADMINISTRATOR_PERMISSION_NAME);
    pe.addAuthorizations(EnumSet.allOf(RoleAuthorization.class));
    entity.setPermission(pe);
    
    ResourceEntity resource = new ResourceEntity();
    resource.setId(1L);
    
    ResourceTypeEntity rte = new ResourceTypeEntity();
    rte.setId(ResourceType.AMBARI.getId());
    rte.setName(ResourceType.AMBARI.name());
    resource.setResourceType(rte);
    entity.setResource(resource);
  }
Sets up a privilege entity to be one that an administrative user would have.
ambari-server/src/main/java/org/apache/ambari/server/security/authorization/internal/InternalAuthenticationToken.java