CLOUDSTACK-7129: Non-admin user can use deleteNetwork with shared

networks

fix ensures only admin users can delete shared network

(cherry picked from commit 2f293f42d5)
Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
This commit is contained in:
Murali Reddy 2014-07-18 17:51:02 +05:30 committed by Rohit Yadav
parent f72eb94554
commit 30dd76fc65
1 changed files with 5 additions and 0 deletions

View File

@ -1797,6 +1797,11 @@ public class NetworkServiceImpl extends ManagerBase implements NetworkService {
Account owner = _accountMgr.getAccount(network.getAccountId());
// Only Admin can delete Shared networks
if (network.getGuestType() == GuestType.Shared && !_accountMgr.isAdmin(caller.getId())) {
throw new InvalidParameterValueException("Only Admins can delete network with guest type " + GuestType.Shared);
}
// Perform permission check
_accountMgr.checkAccess(caller, null, true, network);