@RequiresSession
  public List<PrincipalEntity> findByPrincipalType(String name) {
    TypedQuery<PrincipalEntity> query = entityManagerProvider.get().createNamedQuery("principalByPrincipalType", PrincipalEntity.class);
    query.setParameter("principal_type", name);
    return  daoUtils.selectList(query);
  }
Find principals having specified permission.

@param id permission id
@return all principals having specified permission
ambari-server/src/main/java/org/apache/ambari/server/orm/dao/PrincipalDAO.java