details: /erp/devel/pi/rev/4279e4913c42
changeset: 9289:4279e4913c42
user: Martin Taal <martin.taal <at> openbravo.com>
date: Wed Dec 22 09:04:28 2010 +0100
summary: Prevent save and removal of objects part of a view
diffstat:
src/org/openbravo/dal/service/OBDal.java | 18 ++++++++++++++++++
1 files changed, 18 insertions(+), 0 deletions(-)
diffs (35 lines):
diff -r cffb019e1744 -r 4279e4913c42 src/org/openbravo/dal/service/OBDal.java
--- a/src/org/openbravo/dal/service/OBDal.java Tue Dec 21 18:34:42 2010 +0100
+++ b/src/org/openbravo/dal/service/OBDal.java Wed Dec 22 09:04:28 2010 +0100
@@ -140,6 +140,15 @@
* the object to persist
*/
public void save(Object obj) {
+
+ // prevent saving of db view objects, this can happen for example if
someone accidentally
+ // exported views in xml and then imports this xml again
+ if (((BaseOBObject) obj).getEntity().isView()) {
+ log.warn("Trying to save an object which is a db-view, ignoring save
operation, entity: "
+ + ((BaseOBObject) obj).getEntity().getName());
+ return;
+ }
+
// set client organization has to be done here before checking write
// access
// not the most nice to do
@@ -164,6 +173,15 @@
* the object to be removed
*/
public void remove(Object obj) {
+
+ // prevent removing of db view objects, this can happen for example if
someone accidentally
+ // exported views in xml and posts this xml using a webservice
+ if (((BaseOBObject) obj).getEntity().isView()) {
+ log.warn("Trying to remove an object which is a db-view, ignoring remove
operation, entity: "
+ + ((BaseOBObject) obj).getEntity().getName());
+ return;
+ }
+
// TODO: add checking if setClientOrganization is really necessary
// TODO: log using entityName
log.debug("Removing object " + obj.getClass().getName());
------------------------------------------------------------------------------
Forrester recently released a report on the Return on Investment (ROI) of
Google Apps. They found a 300% ROI, 38%-56% cost savings, and break-even
within 7 months. Over 3 million businesses have gone Google with Google Apps:
an online email calendar, and document program that's accessible from your
browser. Read the Forrester report: http://p.sf.net/sfu/googleapps-sfnew
_______________________________________________
Openbravo-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openbravo-commits