Search in sources :

Example 1 with TenantPreferences

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);
}
Also used : TenantPreferences(com.emc.storageos.db.client.model.uimodels.TenantPreferences) StorageOSUser(com.emc.storageos.security.authentication.StorageOSUser) Path(javax.ws.rs.Path) Produces(javax.ws.rs.Produces) GET(javax.ws.rs.GET)

Example 2 with TenantPreferences

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);
}
Also used : TenantPreferences(com.emc.storageos.db.client.model.uimodels.TenantPreferences) StorageOSUser(com.emc.storageos.security.authentication.StorageOSUser) Path(javax.ws.rs.Path) Consumes(javax.ws.rs.Consumes) Produces(javax.ws.rs.Produces) PUT(javax.ws.rs.PUT) CheckPermission(com.emc.storageos.security.authorization.CheckPermission)

Example 3 with 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;
}
Also used : TenantPreferences(com.emc.storageos.db.client.model.uimodels.TenantPreferences)

Aggregations

TenantPreferences (com.emc.storageos.db.client.model.uimodels.TenantPreferences)3 StorageOSUser (com.emc.storageos.security.authentication.StorageOSUser)2 Path (javax.ws.rs.Path)2 Produces (javax.ws.rs.Produces)2 CheckPermission (com.emc.storageos.security.authorization.CheckPermission)1 Consumes (javax.ws.rs.Consumes)1 GET (javax.ws.rs.GET)1 PUT (javax.ws.rs.PUT)1