You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by bh...@apache.org on 2017/07/24 10:42:56 UTC

[cloudstack] branch 4.9 updated: CLOUDSTACK-9985: Allow creation of roles with names of deleted roles

This is an automated email from the ASF dual-hosted git repository.

bhaisaab pushed a commit to branch 4.9
in repository https://gitbox.apache.org/repos/asf/cloudstack.git


The following commit(s) were added to refs/heads/4.9 by this push:
     new de0d1c7  CLOUDSTACK-9985: Allow creation of roles with names of deleted roles
de0d1c7 is described below

commit de0d1c7893f109544415cbe531598cf996fbfe8b
Author: Rohit Yadav <ro...@shapeblue.com>
AuthorDate: Thu Jul 6 13:20:35 2017 +0530

    CLOUDSTACK-9985: Allow creation of roles with names of deleted roles
    
    This allows admins to create roles with names of previously deleted
    roles.
    
    Signed-off-by: Rohit Yadav <ro...@shapeblue.com>
---
 server/src/org/apache/cloudstack/acl/RoleManagerImpl.java | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/server/src/org/apache/cloudstack/acl/RoleManagerImpl.java b/server/src/org/apache/cloudstack/acl/RoleManagerImpl.java
index 7363b13..27cb3d0 100644
--- a/server/src/org/apache/cloudstack/acl/RoleManagerImpl.java
+++ b/server/src/org/apache/cloudstack/acl/RoleManagerImpl.java
@@ -50,6 +50,7 @@ import javax.inject.Inject;
 import java.io.File;
 import java.util.ArrayList;
 import java.util.Collections;
+import java.util.Date;
 import java.util.List;
 
 @Local(value = {RoleService.class})
@@ -172,7 +173,12 @@ public class RoleManagerImpl extends ManagerBase implements RoleService, Configu
                             rolePermissionsDao.remove(rolePermission.getId());
                         }
                     }
-                    return roleDao.remove(role.getId());
+                    if (roleDao.remove(role.getId())) {
+                        RoleVO roleVO = roleDao.findByIdIncludingRemoved(role.getId());
+                        roleVO.setName(role.getName() + "-deleted-" + new Date());
+                        return roleDao.update(role.getId(), roleVO);
+                    }
+                    return false;
                 }
             });
         }

-- 
To stop receiving notification emails like this one, please contact
['"commits@cloudstack.apache.org" <co...@cloudstack.apache.org>'].