Skip to content

Commit 30dd76f

Browse files
murali-reddyyadvr
authored andcommitted
CLOUDSTACK-7129: Non-admin user can use deleteNetwork with shared
networks fix ensures only admin users can delete shared network (cherry picked from commit 2f293f4) Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
1 parent f72eb94 commit 30dd76f

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

‎server/src/com/cloud/network/NetworkServiceImpl.java‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1797,6 +1797,11 @@ public boolean deleteNetwork(long networkId, boolean forced) {
17971797

17981798
Account owner = _accountMgr.getAccount(network.getAccountId());
17991799

1800+
// Only Admin can delete Shared networks
1801+
if (network.getGuestType() == GuestType.Shared && !_accountMgr.isAdmin(caller.getId())) {
1802+
throw new InvalidParameterValueException("Only Admins can delete network with guest type " + GuestType.Shared);
1803+
}
1804+
18001805
// Perform permission check
18011806
_accountMgr.checkAccess(caller, null, true, network);
18021807

0 commit comments

Comments
 (0)