lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From no...@apache.org
Subject lucene-solr:master: SOLR-10793: BlobHandler should have a well-known permission name
Date Thu, 01 Jun 2017 04:15:37 GMT
Repository: lucene-solr
Updated Branches:
  refs/heads/master 82f2a3539 -> 4a378eb0a


SOLR-10793:  BlobHandler should have a well-known permission name


Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/4a378eb0
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/4a378eb0
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/4a378eb0

Branch: refs/heads/master
Commit: 4a378eb0ad9963579ebc45e4b3755f378e7500cc
Parents: 82f2a35
Author: Noble Paul <noble@apache.org>
Authored: Thu Jun 1 13:44:02 2017 +0930
Committer: Noble Paul <noble@apache.org>
Committed: Thu Jun 1 13:44:02 2017 +0930

----------------------------------------------------------------------
 solr/CHANGES.txt                                  |  2 ++
 .../java/org/apache/solr/handler/BlobHandler.java | 18 +++++++++++++++++-
 2 files changed, 19 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/4a378eb0/solr/CHANGES.txt
----------------------------------------------------------------------
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index 98f3ec2..e52cf17 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -203,6 +203,8 @@ Other Changes
 
 * SOLR-10757: delete/refactor/cleanup CollectionAdminRequest deprecations (hossman)
 
+* SOLR-10793: BlobHandler should have a well-known permission name (noble)
+
 ==================  6.7.0 ==================
 
 Consult the LUCENE_CHANGES.txt file for additional, low level, changes in this release.

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/4a378eb0/solr/core/src/java/org/apache/solr/handler/BlobHandler.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/handler/BlobHandler.java b/solr/core/src/java/org/apache/solr/handler/BlobHandler.java
index 052fcfe..93cf80c 100644
--- a/solr/core/src/java/org/apache/solr/handler/BlobHandler.java
+++ b/solr/core/src/java/org/apache/solr/handler/BlobHandler.java
@@ -54,6 +54,8 @@ import org.apache.solr.request.SolrRequestInfo;
 import org.apache.solr.response.SolrQueryResponse;
 import org.apache.solr.schema.FieldType;
 import org.apache.solr.search.QParser;
+import org.apache.solr.security.AuthorizationContext;
+import org.apache.solr.security.PermissionNameProvider;
 import org.apache.solr.update.AddUpdateCommand;
 import org.apache.solr.update.CommitUpdateCommand;
 import org.apache.solr.update.processor.UpdateRequestProcessor;
@@ -69,8 +71,9 @@ import static org.apache.solr.common.params.CommonParams.JSON;
 import static org.apache.solr.common.params.CommonParams.SORT;
 import static org.apache.solr.common.params.CommonParams.VERSION;
 import static org.apache.solr.common.util.Utils.makeMap;
+import static org.apache.solr.security.PermissionNameProvider.Name.UPDATE_PERM;
 
-public class BlobHandler extends RequestHandlerBase implements PluginInfoInitialized {
+public class BlobHandler extends RequestHandlerBase implements PluginInfoInitialized , PermissionNameProvider
{
   private static final Logger log = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
 
   private static final long DEFAULT_MAX_SIZE = 5 * 1024 * 1024; // 5MB
@@ -293,4 +296,17 @@ public class BlobHandler extends RequestHandlerBase implements PluginInfoInitial
   public Collection<Api> getApis() {
     return ApiBag.wrapRequestHandlers(this, "core.system.blob", "core.system.blob.upload");
   }
+
+  @Override
+  public Name getPermissionName(AuthorizationContext ctx) {
+    switch (ctx.getHttpMethod()) {
+      case "GET":
+        return Name.READ_PERM;
+      case "POST":
+        return Name.UPDATE_PERM;
+      default:
+        return null;
+    }
+
+  }
 }


Mime
View raw message