java/code/src/com/redhat/rhn/frontend/xmlrpc/errata/ErrataHandler.java | 32 +++++-----
1 file changed, 18 insertions(+), 14 deletions(-)
New commits:
commit 44ae2fc89e9ac27f5548d25b4d848ab3b9a31b4e
Author: Justin Sherrill <jsherril(a)redhat.com>
Date: Thu Apr 12 11:52:24 2012 -0400
812053 - making errata.clone api not requires cloned channels
diff --git a/java/code/src/com/redhat/rhn/frontend/xmlrpc/errata/ErrataHandler.java
b/java/code/src/com/redhat/rhn/frontend/xmlrpc/errata/ErrataHandler.java
index 6da34c3..723fd0a 100644
--- a/java/code/src/com/redhat/rhn/frontend/xmlrpc/errata/ErrataHandler.java
+++ b/java/code/src/com/redhat/rhn/frontend/xmlrpc/errata/ErrataHandler.java
@@ -891,23 +891,27 @@ public class ErrataHandler extends BaseHandler {
throw new NoSuchChannelException();
}
- if (!channel.isCloned()) {
- throw new InvalidChannelException("Cloned channel expected: " +
+ //if calling cloneAsOriginal, do additional checks to verify a clone
+ if(inheritAllPackages){
+ if (!channel.isCloned()) {
+ throw new InvalidChannelException("Cloned channel expected: "
+
channel.getLabel());
- }
-
- Channel original = ChannelFactory.lookupOriginalChannel(channel);
+ }
- if (original == null) {
- throw new InvalidChannelException("Cannot access original " +
- "of the channel: " + channel.getLabel());
+ Channel original = ChannelFactory.lookupOriginalChannel(channel);
+
+ if (original == null) {
+ throw new InvalidChannelException("Cannot access original " +
+ "of the channel: " + channel.getLabel());
+ }
+ // check access to the original
+ if (ChannelFactory.lookupByIdAndUser(original.getId(), loggedInUser) == null)
{
+ throw new LookupException("User " + loggedInUser.getLogin() +
+ " does not have access to channel " +
original.getLabel());
+ }
+
}
- // check access to the original
- if (ChannelFactory.lookupByIdAndUser(original.getId(), loggedInUser) == null) {
- throw new LookupException("User " + loggedInUser.getLogin() +
- " does not have access to channel " +
original.getLabel());
- }
if (!UserManager.verifyChannelAdmin(loggedInUser, channel)) {
throw new PermissionCheckFailureException();
@@ -943,7 +947,7 @@ public class ErrataHandler extends BaseHandler {
//Now publish them all to the channel in a single shot
List<Errata> published = ErrataFactory.publishToChannel(errataToPublish,
channel,
- loggedInUser, true);
+ loggedInUser, inheritAllPackages);
for (Errata e : published) {
ErrataFactory.save(e);
}
Show replies by date