Skip to content

Commit

Permalink
Minor changes
Browse files Browse the repository at this point in the history
  • Loading branch information
tushar-97 committed Aug 12, 2019
1 parent 46a0d93 commit a045ec2
Show file tree
Hide file tree
Showing 9 changed files with 10 additions and 10 deletions.
Expand Up @@ -119,7 +119,7 @@ public void start() throws Exception {
"{ 'username' : '%s' , 'role' : '%s' }", username,
role);
Date dateExpires = dateFormat.parse(expires);
// FIXME fix protocol
// The utility only works with api keys for the time being
try {
JsonObject serverResponse = trustedAppClient.authorizeNewUser("api_key",
email, dateExpires.getTime(), comments);
Expand Down
Expand Up @@ -156,7 +156,7 @@ else if(configuration.getUsername().isEmpty() && configuration.getPassword().isE

if(role != null & authorization) {
if (!getAuthorizationRulesCache().getIfPresent(role.toString()).
contains(object.get("Project").toString())) {
contains(object.get("project").toString())) {
throw new Exception("Not authorized to execute this query.");
}
}
Expand All @@ -180,7 +180,7 @@ else if(submitEndpointProperties.getInputType()!=null && submitEndpointPropertie
if(role != null & authorization) {
for (DBObject o : object) {
if(!getAuthorizationRulesCache().getIfPresent(role.toString()).
contains(o.get("Project").toString())){
contains(o.get("project").toString())){
throw new ProviderException(MongoDBProvider.class.getName() , MongoDBProvider.VERSION, "Not authorized to execute this query.");
}
}
Expand Down
Expand Up @@ -40,7 +40,7 @@ public QueryResult handleOperation(DBCollection collection,
if(authorization) {
for(DBObject o : cursor) {
if(!getAuthorizationRulesCache().getIfPresent(role).
contains(o.get("Project").toString())){
contains(o.get("project").toString())){
throw new ProviderException(MongoDBProvider.class.getName() , MongoDBProvider.VERSION, "Not authorized to execute this query.");
}
}
Expand Down
Expand Up @@ -39,7 +39,7 @@ public QueryResult handleOperation(DBCollection collection,
if(authorization) {
for(DBObject o : cursor) {
if(!getAuthorizationRulesCache().getIfPresent(role).
contains(o.get("Project").toString())){
contains(o.get("project").toString())){
throw new ProviderException(MongoDBProvider.class.getName() , MongoDBProvider.VERSION, "Not authorized to execute this query.");
}
}
Expand Down
Expand Up @@ -29,7 +29,7 @@ public class DistinctOperationHandler implements IOperationHandler {

@Override
public QueryResult handleOperation(DBCollection collection,
OutputFormatProps outputFormatProps, JsonObject operationArguments , OutputFormatRegistry registry)
OutputFormatProps outputFormatProps, JsonObject operationArguments , OutputFormatRegistry registry, String role, boolean authorization)
throws ProviderException {
DistinctOperationDescriptor operationDescriptor = GSONUtil.getGSONInstance().fromJson(operationArguments, DistinctOperationDescriptor.class);
validateArguments(operationDescriptor);
Expand Down
Expand Up @@ -58,7 +58,7 @@ public QueryResult handleOperation(DBCollection collection,
if(authorization) {
for(DBObject o : cursor) {
if(!getAuthorizationRulesCache().getIfPresent(role).
contains(o.get("Project").toString())){
contains(o.get("project").toString())){
throw new ProviderException(MongoDBProvider.class.getName() , MongoDBProvider.VERSION, "Not authorized to execute this query.");
}
}
Expand Down
Expand Up @@ -23,7 +23,7 @@ public class GroupOperationHandler implements IOperationHandler {
private Log log = LogFactory.getLog(getClass());
@Override
public QueryResult handleOperation(DBCollection collection,
OutputFormatProps outputFormatProps, JsonObject operationArguments , OutputFormatRegistry registry)
OutputFormatProps outputFormatProps, JsonObject operationArguments , OutputFormatRegistry registry, String role, boolean authorization)
throws ProviderException {
GroupOperationDescriptor operationDescriptor = GSONUtil.getGSONInstance().fromJson(operationArguments, GroupOperationDescriptor.class);
validateArguments(operationDescriptor);
Expand Down
Expand Up @@ -25,7 +25,7 @@ public class MapReduceOperationHandler implements IOperationHandler {
private Log log = LogFactory.getLog(getClass());
@Override
public QueryResult handleOperation(DBCollection collection,
OutputFormatProps outputFormatProps, JsonObject operationArguments , OutputFormatRegistry registry)
OutputFormatProps outputFormatProps, JsonObject operationArguments , OutputFormatRegistry registry, String role, boolean authorization)
throws ProviderException {
MapReduceOperationDescriptor operationDescriptor = GSONUtil.getGSONInstance().fromJson(operationArguments, MapReduceOperationDescriptor.class);
validateArguments(operationDescriptor);
Expand Down
Expand Up @@ -39,7 +39,7 @@ public QueryResult handleOperation(DBCollection collection,
if(authorization) {
for(DBObject o : cursor) {
if(!getAuthorizationRulesCache().getIfPresent(role).
contains(o.get("Project").toString())){
contains(o.get("project").toString())){
throw new ProviderException(MongoDBProvider.class.getName() , MongoDBProvider.VERSION, "Not authorized to execute this query.");
}
}
Expand Down

0 comments on commit a045ec2

Please sign in to comment.