juddi-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jfa...@apache.org
Subject svn commit: r765318 - in /webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi: api/impl/UDDISubscriptionImpl.java validation/ValidateSubscription.java
Date Wed, 15 Apr 2009 19:27:07 GMT
Author: jfaath
Date: Wed Apr 15 19:27:07 2009
New Revision: 765318

URL: http://svn.apache.org/viewvc?rev=765318&view=rev
Log:
accounting for subscription ownership

Modified:
    webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/api/impl/UDDISubscriptionImpl.java
    webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/validation/ValidateSubscription.java

Modified: webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/api/impl/UDDISubscriptionImpl.java
URL: http://svn.apache.org/viewvc/webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/api/impl/UDDISubscriptionImpl.java?rev=765318&r1=765317&r2=765318&view=diff
==============================================================================
--- webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/api/impl/UDDISubscriptionImpl.java
(original)
+++ webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/api/impl/UDDISubscriptionImpl.java
Wed Apr 15 19:27:07 2009
@@ -139,6 +139,8 @@
 			doSubscriptionExpirationDate(apiSubscription);
 			
 			MappingApiToModel.mapSubscription(apiSubscription, modelSubscription);
+			
+			modelSubscription.setAuthorizedName(publisher.getAuthorizedName());
 
 			// Add the matching keys to the match collection
 			List<?> keys = getSubscriptionMatches(apiSubscription.getSubscriptionFilter(), em);

Modified: webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/validation/ValidateSubscription.java
URL: http://svn.apache.org/viewvc/webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/validation/ValidateSubscription.java?rev=765318&r1=765317&r2=765318&view=diff
==============================================================================
--- webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/validation/ValidateSubscription.java
(original)
+++ webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/validation/ValidateSubscription.java
Wed Apr 15 19:27:07 2009
@@ -26,6 +26,7 @@
 import org.apache.juddi.error.FatalErrorException;
 import org.apache.juddi.error.InvalidKeyPassedException;
 import org.apache.juddi.error.KeyUnavailableException;
+import org.apache.juddi.error.UserMismatchException;
 import org.apache.juddi.error.ValueNotAllowedException;
 import org.apache.juddi.keygen.KeyGenerator;
 import org.apache.juddi.keygen.KeyGeneratorFactory;
@@ -76,11 +77,9 @@
 			if (obj != null) {
 				entityExists = true;
 
-				// Subscriptions don't specify ownership.  Therefore, anyone can change a subscription
(if they have the key).  
-				// This could be implemented by adding the authorizedName field to the model class.
 				// Make sure publisher owns this entity.
-				//if (!publisher.isOwner((UddiEntity)obj))
-				//	throw new UserMismatchException(new ErrorMessage("errors.usermismatch.InvalidOwner",
entityKey));
+				if (!publisher.getAuthorizedName().equals(((org.apache.juddi.model.Subscription)obj).getAuthorizedName()))
+					throw new UserMismatchException(new ErrorMessage("errors.usermismatch.InvalidOwner",
entityKey));
 			}
 			else {
 				// Inside this block, we have a key proposed by the publisher on a new entity
@@ -182,9 +181,9 @@
 			if (obj == null)
 				throw new InvalidKeyPassedException(new ErrorMessage("errors.invalidkey.SubscriptionNotFound",
entityKey));
 			
-			// No ownership specified for subscriptions
-			//if (!publisher.isOwner((UddiEntity)obj))
-			//	throw new UserMismatchException(new ErrorMessage("errors.usermismatch.InvalidOwner",
entityKey));
+			// Make sure publisher owns this entity.
+			if (!publisher.getAuthorizedName().equals(((org.apache.juddi.model.Subscription)obj).getAuthorizedName()))
+				throw new UserMismatchException(new ErrorMessage("errors.usermismatch.InvalidOwner",
entityKey));
 			
 		}
 	}



---------------------------------------------------------------------
To unsubscribe, e-mail: juddi-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: juddi-cvs-help@ws.apache.org


Mime
View raw message