Ravi Nori has uploaded a new change for review.

Change subject: restapi : if "filter: ..." header is set, use query instead of 
search to list items
......................................................................

restapi : if "filter: ..." header is set, use query instead of search to list 
items

When the filter option is specified the api query should not
throw a insufficient permissions exception. Instead the query should
return a list of objects that the user has permissions for.

This patch fixes /events/{id}

Change-Id: Ia2ab0e1e62b9cc67fad51da5e5e0b2c1163087a6
Bug-Url: https://bugzilla.redhat.com/869334
Signed-off-by: Ravi Nori <rn...@redhat.com>
---
M 
backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/queries/VdcQueryType.java
M 
backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/BackendEventsResource.java
M 
backend/manager/tools/src/main/java/org/ovirt/engine/core/tools/common/db/StandaloneDataSource.java
3 files changed, 10 insertions(+), 8 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/74/14274/1

diff --git 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/queries/VdcQueryType.java
 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/queries/VdcQueryType.java
index fbc99f9..fbd9cbf 100644
--- 
a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/queries/VdcQueryType.java
+++ 
b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/queries/VdcQueryType.java
@@ -17,7 +17,7 @@
     IsBalloonEnabled(VdcQueryAuthType.User),
 
     // Vds queries
-    GetVdsByVdsId,
+    GetVdsByVdsId(VdcQueryAuthType.User),
     GetVdsByName,
     GetVdsFenceStatus,
     GetNewVdsFenceStatus,
@@ -27,7 +27,7 @@
     GetVlanParent,
     GetVdsHooksById,
     GetVdsHooksById2,
-    GetAllHosts,
+    GetAllHosts(VdcQueryAuthType.User),
     GetHostsByClusterId(VdcQueryAuthType.User),
     IsDisplayAddressConsistentInCluster,
     GetAllVdsByStoragePool(VdcQueryAuthType.User),
diff --git 
a/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/BackendEventsResource.java
 
b/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/BackendEventsResource.java
index f0cb70b..3d145bf 100644
--- 
a/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/BackendEventsResource.java
+++ 
b/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/BackendEventsResource.java
@@ -26,11 +26,7 @@
 
     @Override
     public Events list() {
-        if (isFiltered()) {
-            return 
mapCollection(getBackendCollection(VdcQueryType.GetAllEventMessages, new 
VdcQueryParametersBase()));
-        } else {
-            return mapCollection(getBackendCollection());
-        }
+        return mapCollection(getBackendCollection());
     }
 
     private Events mapCollection(List<AuditLog> entities) {
@@ -48,7 +44,11 @@
     }
 
     private List<AuditLog> getBackendCollection() {
-        return getBackendCollection(SearchType.AuditLog);
+        if (isFiltered()) {
+            return getBackendCollection(VdcQueryType.GetAllEventMessages, new 
VdcQueryParametersBase());
+        } else {
+            return getBackendCollection(SearchType.AuditLog);
+        }
     }
 
     public Event lookupEvent(String id) {
diff --git 
a/backend/manager/tools/src/main/java/org/ovirt/engine/core/tools/common/db/StandaloneDataSource.java
 
b/backend/manager/tools/src/main/java/org/ovirt/engine/core/tools/common/db/StandaloneDataSource.java
index 7760375..5493024 100644
--- 
a/backend/manager/tools/src/main/java/org/ovirt/engine/core/tools/common/db/StandaloneDataSource.java
+++ 
b/backend/manager/tools/src/main/java/org/ovirt/engine/core/tools/common/db/StandaloneDataSource.java
@@ -48,11 +48,13 @@
         user = config.getProperty(ENGINE_DB_USER);
         password = config.getProperty(ENGINE_DB_PASSWORD);
 
+        if (password.length() > 0) {
         // The password is encrypted inside the file, so we need to decrypt it 
here:
         password = EncryptionUtils.decode(password, "", "");
         if (password == null) {
             throw new SQLException("Failed to decrypt password from parameter 
\"" + ENGINE_DB_PASSWORD + "\".");
         }
+        }
 
         // Load the driver:
         try {


--
To view, visit http://gerrit.ovirt.org/14274
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia2ab0e1e62b9cc67fad51da5e5e0b2c1163087a6
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Ravi Nori <rn...@redhat.com>
_______________________________________________
Engine-patches mailing list
Engine-patches@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to