mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
server: Allow users to create L2 network types (#3158)
Allow users of all types to create L2 guest networks. Fixes #3081
This commit is contained in:
parent
f7327c7457
commit
55fb1c4eb6
@ -1101,8 +1101,8 @@ public class NetworkServiceImpl extends ManagerBase implements NetworkService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Only Admin can create Shared networks
|
// Only Admin can create Shared networks
|
||||||
if ((ntwkOff.getGuestType() == GuestType.Shared || ntwkOff.getGuestType() == GuestType.L2) && !_accountMgr.isAdmin(caller.getId())) {
|
if ((ntwkOff.getGuestType() == GuestType.Shared) && !_accountMgr.isAdmin(caller.getId())) {
|
||||||
throw new InvalidParameterValueException("Only Admins can create network with guest type " + GuestType.Shared + " or " + GuestType.L2);
|
throw new InvalidParameterValueException("Only Admins can create network with guest type " + GuestType.Shared);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if the network is domain specific
|
// Check if the network is domain specific
|
||||||
@ -1822,8 +1822,8 @@ public class NetworkServiceImpl extends ManagerBase implements NetworkService {
|
|||||||
|
|
||||||
Account owner = _accountMgr.getAccount(network.getAccountId());
|
Account owner = _accountMgr.getAccount(network.getAccountId());
|
||||||
|
|
||||||
// Only Admin can delete Shared and L2 networks
|
// Only Admin can delete Shared
|
||||||
if ((network.getGuestType() == GuestType.Shared || network.getGuestType() == GuestType.L2) && !_accountMgr.isAdmin(caller.getId())) {
|
if ((network.getGuestType() == GuestType.Shared) && !_accountMgr.isAdmin(caller.getId())) {
|
||||||
throw new InvalidParameterValueException("Only Admins can delete network with guest type " + network.getGuestType());
|
throw new InvalidParameterValueException("Only Admins can delete network with guest type " + network.getGuestType());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -795,7 +795,7 @@
|
|||||||
isHeader: true
|
isHeader: true
|
||||||
}),
|
}),
|
||||||
|
|
||||||
rootAdminAddL2Network: $.extend({}, addL2GuestNetwork.def, {
|
AddL2Network: $.extend({}, addL2GuestNetwork.def, {
|
||||||
isHeader: true
|
isHeader: true
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@ -831,13 +831,6 @@ var addL2GuestNetwork = {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
preFilter: function(args) {
|
|
||||||
if (isAdmin())
|
|
||||||
return true;
|
|
||||||
else
|
|
||||||
return false;
|
|
||||||
},
|
|
||||||
|
|
||||||
createForm: {
|
createForm: {
|
||||||
title: 'label.add.l2.guest.network',
|
title: 'label.add.l2.guest.network',
|
||||||
fields: {
|
fields: {
|
||||||
@ -867,7 +860,7 @@ var addL2GuestNetwork = {
|
|||||||
url: createURL('listZones'),
|
url: createURL('listZones'),
|
||||||
success: function(json) {
|
success: function(json) {
|
||||||
var zones = $.grep(json.listzonesresponse.zone, function(zone) {
|
var zones = $.grep(json.listzonesresponse.zone, function(zone) {
|
||||||
return (zone.networktype == 'Advanced' && zone.securitygroupsenabled != true); //Isolated networks can only be created in Advanced SG-disabled zone (but not in Basic zone nor Advanced SG-enabled zone)
|
return (zone.networktype == 'Advanced'); //Isolated networks can only be created in Advanced SG-disabled zone (but not in Basic zone nor Advanced SG-enabled zone)
|
||||||
});
|
});
|
||||||
|
|
||||||
args.response.success({
|
args.response.success({
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user