Search in sources :

Example 1 with RoleSetExposingSecurityExpressionRoot

use of com.thinkbiganalytics.metadata.config.RoleSetExposingSecurityExpressionRoot 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)

Example 2 with RoleSetExposingSecurityExpressionRoot

use of com.thinkbiganalytics.metadata.config.RoleSetExposingSecurityExpressionRoot in project kylo by Teradata.

the class CacheService method getDashboard.

/**
 * We need the Acl List populated in order to do the correct fetch
 * Fetch the components of the dashboard in separate threads
 */
public Dashboard getDashboard(FeedHealthSummaryCache.FeedSummaryFilter feedSummaryFilter) {
    Dashboard dashboard = null;
    if (!accessController.isEntityAccessControlled() || (accessController.isEntityAccessControlled() && feedAclCache.isAvailable())) {
        Long time = TimeUtil.getTimeNearestFiveSeconds();
        RoleSetExposingSecurityExpressionRoot userContext = feedAclCache.userContext();
        DashboardAction dashboardAction = new DashboardAction(time, userContext, feedSummaryFilter);
        CyclicBarrier barrier = new CyclicBarrier(5, dashboardAction);
        List<ThreadedDashboardTask> tasks = new ArrayList<>();
        tasks.add(new ThreadedDashboardTask(barrier, () -> feedHealthSummaryCache.getCache(time)));
        tasks.add(new ThreadedDashboardTask(barrier, () -> dataConfidenceJobsCache.getCache(time)));
        tasks.add(new ThreadedDashboardTask(barrier, () -> alertsCache.getCache(time)));
        tasks.add(new ThreadedDashboardTask(barrier, () -> serviceStatusCache.getCache(time)));
        tasks.stream().forEach(t -> executor.submit(t));
        try {
            barrier.await();
        } catch (Exception e) {
        }
        return dashboardAction.getDashboard();
    } else {
        return Dashboard.NOT_READY;
    }
}
Also used : ArrayList(java.util.ArrayList) RoleSetExposingSecurityExpressionRoot(com.thinkbiganalytics.metadata.config.RoleSetExposingSecurityExpressionRoot) CyclicBarrier(java.util.concurrent.CyclicBarrier)

Aggregations

RoleSetExposingSecurityExpressionRoot (com.thinkbiganalytics.metadata.config.RoleSetExposingSecurityExpressionRoot)2 JpaFeedOpsAclEntry (com.thinkbiganalytics.metadata.jpa.feed.security.JpaFeedOpsAclEntry)1 QJpaFeedOpsAclEntry (com.thinkbiganalytics.metadata.jpa.feed.security.QJpaFeedOpsAclEntry)1 ArrayList (java.util.ArrayList)1 CyclicBarrier (java.util.concurrent.CyclicBarrier)1