use of com.cinchapi.concourse.thrift.AccessToken in project concourse by cinchapi.
the class ConcourseServer method selectKeysCriteriaOrder.
@Override
@TranslateClientExceptions
@VerifyAccessToken
@VerifyReadPermission
public Map<Long, Map<String, Set<TObject>>> selectKeysCriteriaOrder(List<String> keys, TCriteria criteria, TOrder order, AccessToken creds, TransactionToken transaction, String environment) throws TException {
AbstractSyntaxTree ast = compiler.parse(criteria);
AtomicSupport store = getStore(transaction, environment);
SortableTable<Set<TObject>> result = emptySortableResultDataset();
AtomicOperations.executeWithRetry(store, atomic -> Operations.selectKeysAstAtomic(keys, ast, Time.NONE, result, null, $result -> $result.sort(Sorting.byValues(Orders.from(order), atomic)), atomic));
return result;
}
use of com.cinchapi.concourse.thrift.AccessToken in project concourse by cinchapi.
the class ConcourseServer method getKeysCclPage.
@Override
@TranslateClientExceptions
@VerifyAccessToken
@VerifyReadPermission
public Map<Long, Map<String, TObject>> getKeysCclPage(List<String> keys, String ccl, TPage page, AccessToken creds, TransactionToken transaction, String environment) throws TException {
try {
AbstractSyntaxTree ast = compiler.parse(ccl);
AtomicSupport store = getStore(transaction, environment);
SortableTable<TObject> result = SortableTable.singleValued(Maps.newLinkedHashMap());
AtomicOperations.executeWithRetry(store, atomic -> Operations.getKeysAstAtomic(keys, ast, Time.NONE, result, records -> Paging.paginate(records, Pages.from(page)), null, atomic));
return result;
} catch (Exception e) {
throw new ParseException(e.getMessage());
}
}
use of com.cinchapi.concourse.thrift.AccessToken in project concourse by cinchapi.
the class ConcourseServer method selectKeyCriteriaTimePage.
@Override
@TranslateClientExceptions
@VerifyAccessToken
@VerifyReadPermission
public Map<Long, Set<TObject>> selectKeyCriteriaTimePage(String key, TCriteria criteria, long timestamp, TPage page, AccessToken creds, TransactionToken transaction, String environment) throws TException {
AbstractSyntaxTree ast = compiler.parse(criteria);
AtomicSupport store = getStore(transaction, environment);
SortableColumn<Set<TObject>> result = SortableColumn.multiValued(key, Maps.newLinkedHashMap());
AtomicOperations.executeWithRetry(store, atomic -> Operations.selectKeyAstAtomic(key, ast, timestamp, result, records -> Paging.paginate(records, Pages.from(page)), null, atomic));
return result;
}
use of com.cinchapi.concourse.thrift.AccessToken in project concourse by cinchapi.
the class ConcourseServer method getKeysRecordsOrder.
@Override
@TranslateClientExceptions
@VerifyAccessToken
@VerifyReadPermission
public Map<Long, Map<String, TObject>> getKeysRecordsOrder(List<String> keys, List<Long> records, TOrder order, AccessToken creds, TransactionToken transaction, String environment) throws TException {
AtomicSupport store = getStore(transaction, environment);
SortableTable<TObject> result = SortableTable.singleValued(Maps.newLinkedHashMap());
AtomicOperations.executeWithRetry(store, atomic -> Operations.getKeysRecordsAtomic(keys, records, result, null, $result -> $result.sort(Sorting.byValue(Orders.from(order), atomic)), atomic));
return result;
}
use of com.cinchapi.concourse.thrift.AccessToken in project concourse by cinchapi.
the class AdminRoleVerificiationAdvice method invoke.
@Override
public Object invoke(MethodInvocation invocation) throws Throwable {
AccessToken token = null;
for (Object arg : invocation.getArguments()) {
if (arg instanceof AccessToken) {
token = (AccessToken) arg;
break;
} else {
continue;
}
}
if (token != null) {
ConcourseServer concourse = (ConcourseServer) invocation.getThis();
Inspector inspector = concourse.inspector();
if (inspector.getTokenUserRole(token) == Role.ADMIN) {
return invocation.proceed();
} else {
throw new SecurityException("Unauthorized");
}
} else {
throw new SecurityException("No token was provided to a method that requires a user with the ADMIN role");
}
}
Aggregations