Search in sources :

Example 1 with QJpaFeedOpsAclEntry

use of com.thinkbiganalytics.metadata.jpa.feed.security.QJpaFeedOpsAclEntry in project kylo by Teradata.

the class FeedAclIndexQueryAugmentor method generateExistsExpression.

/**
 * Generates the Exist expression for the feed to feedacl table
 *
 * @return exists expression
 */
private static BooleanExpression generateExistsExpression(QOpsManagerFeedId feedId) {
    LOG.debug("FeedAclIndexQueryAugmentor.generateExistsExpression(QOpsManagerFeedId)");
    RoleSetExposingSecurityExpressionRoot userCxt = getUserContext();
    QJpaFeedOpsAclEntry aclEntry = QJpaFeedOpsAclEntry.jpaFeedOpsAclEntry;
    JPQLQuery<JpaFeedOpsAclEntry> subquery = JPAExpressions.selectFrom(aclEntry).where(aclEntry.feed.id.eq(feedId).and(aclEntry.principalName.in(userCxt.getGroups()).and(aclEntry.principalType.eq(FeedOpsAclEntry.PrincipalType.GROUP)).or(aclEntry.principalName.eq(userCxt.getName()).and(aclEntry.principalType.eq(FeedOpsAclEntry.PrincipalType.USER)))));
    return subquery.exists();
}
Also used : QJpaFeedOpsAclEntry(com.thinkbiganalytics.metadata.jpa.feed.security.QJpaFeedOpsAclEntry) JpaFeedOpsAclEntry(com.thinkbiganalytics.metadata.jpa.feed.security.JpaFeedOpsAclEntry) QJpaFeedOpsAclEntry(com.thinkbiganalytics.metadata.jpa.feed.security.QJpaFeedOpsAclEntry) RoleSetExposingSecurityExpressionRoot(com.thinkbiganalytics.metadata.config.RoleSetExposingSecurityExpressionRoot)

Aggregations

RoleSetExposingSecurityExpressionRoot (com.thinkbiganalytics.metadata.config.RoleSetExposingSecurityExpressionRoot)1 JpaFeedOpsAclEntry (com.thinkbiganalytics.metadata.jpa.feed.security.JpaFeedOpsAclEntry)1 QJpaFeedOpsAclEntry (com.thinkbiganalytics.metadata.jpa.feed.security.QJpaFeedOpsAclEntry)1