Skip to content

Commit de0d1c7

Browse files
yadvrRohit Yadav
authored andcommitted
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>
1 parent 90e7cab commit de0d1c7

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

server/src/org/apache/cloudstack/acl/RoleManagerImpl.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@
5050
import java.io.File;
5151
import java.util.ArrayList;
5252
import java.util.Collections;
53+
import java.util.Date;
5354
import java.util.List;
5455

5556
@Local(value = {RoleService.class})
@@ -172,7 +173,12 @@ public Boolean doInTransaction(TransactionStatus status) {
172173
rolePermissionsDao.remove(rolePermission.getId());
173174
}
174175
}
175-
return roleDao.remove(role.getId());
176+
if (roleDao.remove(role.getId())) {
177+
RoleVO roleVO = roleDao.findByIdIncludingRemoved(role.getId());
178+
roleVO.setName(role.getName() + "-deleted-" + new Date());
179+
return roleDao.update(role.getId(), roleVO);
180+
}
181+
return false;
176182
}
177183
});
178184
}

0 commit comments

Comments
 (0)