cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bhais...@apache.org
Subject [cloudstack] branch 4.9 updated: CLOUDSTACK-9985: Allow creation of roles with names of deleted roles
Date Mon, 24 Jul 2017 10:42:56 GMT
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 <rohit.yadav@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 <rohit.yadav@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" <commits@cloudstack.apache.org>'].

Mime
View raw message