use of util.builders.ACLUpdateBuilder in project coprhd-controller by CoprHD.
the class VirtualPoolCommonForm method saveTenantACLs.
/**
* Saves the tenant ACL information using the provided ACLResources.
*
* @param resources
* the resources on which to save the tenant ACLs.
*/
protected void saveTenantACLs(ACLResources resources) {
// Only allow a user than can read all tenants and update ACLs do this
if (TenantUtils.canReadAllTenants() && VirtualPoolUtils.canUpdateACLs()) {
URI virtualPoolId = ResourceUtils.uri(id);
if (virtualPoolId != null) {
Set<String> tenantIds = Sets.newHashSet();
if (isTrue(enableTenants) && (tenants != null)) {
tenantIds.addAll(tenants);
}
ACLUpdateBuilder builder = new ACLUpdateBuilder(resources.getACLs(virtualPoolId));
builder.setTenants(tenantIds);
resources.updateACLs(virtualPoolId, builder.getACLUpdate());
}
}
}
use of util.builders.ACLUpdateBuilder in project coprhd-controller by CoprHD.
the class VirtualArrays method saveTenantACLs.
/**
* Saves tenant ACLs on the virtual array.
*
* @param virtualArrayId
* the virtual array ID.
* @param tenants
* the tenant ACLs.
*/
private static void saveTenantACLs(String virtualArrayId, List<String> tenants) {
Set<String> tenantIds = Sets.newHashSet();
if (tenants != null) {
tenantIds.addAll(tenants);
}
ACLUpdateBuilder builder = new ACLUpdateBuilder(VirtualArrayUtils.getACLs(virtualArrayId));
builder.setTenants(tenantIds);
try {
VirtualArrayUtils.updateACLs(virtualArrayId, builder.getACLUpdate());
} catch (ViPRException e) {
Logger.error(e, "Failed to update Virtual Array ACLs");
String errorDesc = e.getMessage();
if (e instanceof ServiceErrorException) {
errorDesc = ((ServiceErrorException) e).getDetailedMessage();
}
flash.error(MessagesUtils.get("varrays.updateVarrayACLs.failed", errorDesc));
}
}
use of util.builders.ACLUpdateBuilder in project coprhd-controller by CoprHD.
the class ComputeVirtualPools method saveTenantACLs.
/**
* Saves tenant ACLs on the virtual compute pool.
*
* @param vpoolId
* the virtual compute pool ID.
* @param tenants
* the tenant ACLs.
* @param enableTenants
* the checked status for "Grant Access to Tenants".
*/
private static void saveTenantACLs(String vpoolId, List<String> tenants, Boolean enableTenants) {
Set<String> tenantIds = Sets.newHashSet();
if (isTrue(enableTenants) && tenants != null) {
tenantIds.addAll(tenants);
}
ACLUpdateBuilder builder = new ACLUpdateBuilder(ComputeVirtualPoolUtils.getComputeACLs(vpoolId));
builder.setTenants(tenantIds);
try {
ComputeVirtualPoolUtils.updateComputeACLs(vpoolId, builder.getACLUpdate());
} catch (ViPRException e) {
Logger.error(e, "Failed to update Compute Virtual Pool ACLs");
String errorDesc = e.getMessage();
if (e instanceof ServiceErrorException) {
errorDesc = ((ServiceErrorException) e).getDetailedMessage();
}
flash.error(MessagesUtils.get("computeVirtualPool.updateComputeVirtualPoolACLs.failed", errorDesc));
}
}
Aggregations