use of com.emc.storageos.db.client.model.uimodels.TenantPreferences in project coprhd-controller by CoprHD.
the class CatalogPreferenceService method get.
@GET
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
@Path("")
public CatalogPreferencesRestRep get(@DefaultValue("") @QueryParam(SearchConstants.TENANT_ID_PARAM) String tenantId) {
StorageOSUser user = getUserFromContext();
if (StringUtils.isBlank(tenantId)) {
tenantId = user.getTenantId();
}
verifyAuthorizedInTenantOrg(uri(tenantId), user);
TenantPreferences catalogPreferences = catalogPreferenceManager.getPreferencesByTenant(tenantId);
return map(catalogPreferences);
}
use of com.emc.storageos.db.client.model.uimodels.TenantPreferences in project coprhd-controller by CoprHD.
the class CatalogPreferenceService method update.
@PUT
@Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
@Path("")
@CheckPermission(roles = { Role.TENANT_ADMIN })
public CatalogPreferencesRestRep update(CatalogPreferencesUpdateParam param) {
String tenantId = param.getTenantId();
StorageOSUser user = getUserFromContext();
if (StringUtils.isBlank(tenantId)) {
tenantId = user.getTenantId();
}
verifyAuthorizedInTenantOrg(uri(tenantId), user);
TenantPreferences tenantPreferences = catalogPreferenceManager.getPreferencesByTenant(tenantId);
validateParam(uri(tenantId), param, tenantPreferences);
updateObject(tenantPreferences, param);
catalogPreferenceManager.updatePreferences(tenantPreferences);
auditOpSuccess(OperationTypeEnum.UPDATE_CATALOG_PREFERENCES, tenantPreferences.auditParameters());
tenantPreferences = catalogPreferenceManager.getPreferences(tenantPreferences.getId());
return map(tenantPreferences);
}
use of com.emc.storageos.db.client.model.uimodels.TenantPreferences in project coprhd-controller by CoprHD.
the class CatalogPreferenceManagerImpl method createNewPreferences.
private TenantPreferences createNewPreferences(String tenantId) {
TenantPreferences newTenantPreferences = new TenantPreferences();
newTenantPreferences.setTenant(tenantId.toString());
client.save(newTenantPreferences);
return newTenantPreferences;
}
Aggregations