incubator-cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kis...@apache.org
Subject git commit: bug CLOUDSTACK-198: VPN user add, on failure remove user currently being added only, other users will remain in Add state
Date Wed, 26 Sep 2012 08:25:28 GMT
Updated Branches:
  refs/heads/master 2da5b448a -> 6540ff8fa


bug CLOUDSTACK-198: VPN user add, on failure remove user currently being added only, other
users will remain in Add state


Project: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/commit/6540ff8f
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/tree/6540ff8f
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/diff/6540ff8f

Branch: refs/heads/master
Commit: 6540ff8fa1db632678418eba55c32fb0ea54b4b8
Parents: 2da5b44
Author: Kishan Kavala <kishan@cloud.com>
Authored: Wed Sep 26 13:53:08 2012 +0530
Committer: Kishan Kavala <kishan@cloud.com>
Committed: Wed Sep 26 13:54:49 2012 +0530

----------------------------------------------------------------------
 api/src/com/cloud/api/commands/AddVpnUserCmd.java  |    2 +-
 .../com/cloud/api/commands/RemoveVpnUserCmd.java   |    2 +-
 .../cloud/network/vpn/RemoteAccessVpnService.java  |    2 +-
 .../network/vpn/RemoteAccessVpnManagerImpl.java    |    4 ++--
 4 files changed, 5 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/6540ff8f/api/src/com/cloud/api/commands/AddVpnUserCmd.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/commands/AddVpnUserCmd.java b/api/src/com/cloud/api/commands/AddVpnUserCmd.java
index 4a4be01..10dc11a 100644
--- a/api/src/com/cloud/api/commands/AddVpnUserCmd.java
+++ b/api/src/com/cloud/api/commands/AddVpnUserCmd.java
@@ -120,7 +120,7 @@ public class AddVpnUserCmd extends BaseAsyncCreateCmd {
     public void execute(){
             VpnUser vpnUser = _entityMgr.findById(VpnUser.class, getEntityId());
             Account account = _entityMgr.findById(Account.class, vpnUser.getAccountId());
-            if (!_ravService.applyVpnUsers(vpnUser.getAccountId())) {
+            if (!_ravService.applyVpnUsers(vpnUser.getAccountId(), userName)) {
                 throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to add vpn user");
             }
             

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/6540ff8f/api/src/com/cloud/api/commands/RemoveVpnUserCmd.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/commands/RemoveVpnUserCmd.java b/api/src/com/cloud/api/commands/RemoveVpnUserCmd.java
index 57a4301..28fe367 100644
--- a/api/src/com/cloud/api/commands/RemoveVpnUserCmd.java
+++ b/api/src/com/cloud/api/commands/RemoveVpnUserCmd.java
@@ -113,7 +113,7 @@ public class RemoveVpnUserCmd extends BaseAsyncCmd {
             throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to remove vpn user");
         }
         
-        if (!_ravService.applyVpnUsers(owner.getId())) {
+        if (!_ravService.applyVpnUsers(owner.getId(), userName)) {
             throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to apply vpn user
removal");
         } 
         SuccessResponse response = new SuccessResponse(getCommandName());

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/6540ff8f/api/src/com/cloud/network/vpn/RemoteAccessVpnService.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/network/vpn/RemoteAccessVpnService.java b/api/src/com/cloud/network/vpn/RemoteAccessVpnService.java
index b1c07a1..b2fb34b 100644
--- a/api/src/com/cloud/network/vpn/RemoteAccessVpnService.java
+++ b/api/src/com/cloud/network/vpn/RemoteAccessVpnService.java
@@ -35,7 +35,7 @@ public interface RemoteAccessVpnService {
     VpnUser addVpnUser(long vpnOwnerId, String userName, String password);
     boolean removeVpnUser(long vpnOwnerId, String userName);
     List<? extends VpnUser> listVpnUsers(long vpnOwnerId, String userName);
-    boolean applyVpnUsers(long vpnOwnerId);
+    boolean applyVpnUsers(long vpnOwnerId, String userName);
     
     List<? extends RemoteAccessVpn> searchForRemoteAccessVpns(ListRemoteAccessVpnsCmd
cmd);
     List<? extends VpnUser> searchForVpnUsers(ListVpnUsersCmd cmd);

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/6540ff8f/server/src/com/cloud/network/vpn/RemoteAccessVpnManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/vpn/RemoteAccessVpnManagerImpl.java b/server/src/com/cloud/network/vpn/RemoteAccessVpnManagerImpl.java
index 1f7fbaa..c01dc6e 100755
--- a/server/src/com/cloud/network/vpn/RemoteAccessVpnManagerImpl.java
+++ b/server/src/com/cloud/network/vpn/RemoteAccessVpnManagerImpl.java
@@ -418,7 +418,7 @@ public class RemoteAccessVpnManagerImpl implements RemoteAccessVpnService,
Manag
 
     @DB
     @Override
-    public boolean applyVpnUsers(long vpnOwnerId) {
+    public boolean applyVpnUsers(long vpnOwnerId, String userName) {
         Account caller = UserContext.current().getCaller();
         Account owner = _accountDao.findById(vpnOwnerId);
         _accountMgr.checkAccess(caller, null, true, owner);
@@ -481,7 +481,7 @@ public class RemoteAccessVpnManagerImpl implements RemoteAccessVpnService,
Manag
                     _vpnUsersDao.remove(user.getId());
                 }
             } else {
-            	if (user.getState() == State.Add) {
+            	if (user.getState() == State.Add && (user.getUsername()).equals(userName))
{
                     Transaction txn = Transaction.currentTxn();
                     txn.start();            		
                     _vpnUsersDao.remove(user.getId());


Mime
View raw message