Search in sources :

Example 21 with CatalogService

use of com.emc.storageos.db.client.model.uimodels.CatalogService in project coprhd-controller by CoprHD.

the class CatalogServiceService method updateRoleAssignments.

@PUT
@Path("/{id}/acl")
@Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
@CheckPermission(roles = { Role.SECURITY_ADMIN, Role.TENANT_ADMIN }, acls = { ACL.OWN }, blockProxies = true)
public ACLAssignments updateRoleAssignments(@PathParam("id") URI id, ACLAssignmentChanges changes) {
    CatalogService catalogService = catalogServiceManager.getCatalogServiceById(id);
    CatalogCategory parentCatalogCategory = catalogCategoryManager.getCatalogCategoryById(catalogService.getCatalogCategoryId().getURI());
    URI tenantId = uri(parentCatalogCategory.getTenant());
    _permissionsHelper.updateACLs(catalogService, changes, new CatalogACLInputFilter(tenantId));
    catalogServiceManager.updateCatalogService(catalogService, null);
    ;
    auditOpSuccess(OperationTypeEnum.MODIFY_CATALOG_SERVICE_ACL, catalogService.getId().toString(), catalogService.getLabel(), changes);
    catalogConfigUtils.notifyCatalogAclChange();
    return getRoleAssignmentsResponse(id);
}
Also used : CatalogService(com.emc.storageos.db.client.model.uimodels.CatalogService) CatalogCategory(com.emc.storageos.db.client.model.uimodels.CatalogCategory) URI(java.net.URI) CatalogACLInputFilter(com.emc.sa.api.utils.CatalogACLInputFilter) Path(javax.ws.rs.Path) Consumes(javax.ws.rs.Consumes) PUT(javax.ws.rs.PUT) CheckPermission(com.emc.storageos.security.authorization.CheckPermission)

Example 22 with CatalogService

use of com.emc.storageos.db.client.model.uimodels.CatalogService in project coprhd-controller by CoprHD.

the class CatalogServiceService method getCatalogService.

/**
 * Get info for catalog category
 *
 * @param id the URN of a Catalog Category
 * @prereq none
 * @brief Show catalog category
 * @return Catalog Category details
 */
@GET
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
@Path("/{id}")
public CatalogServiceRestRep getCatalogService(@PathParam("id") URI id) {
    CatalogService catalogService = queryResource(id);
    ServiceDescriptor serviceDescriptor = getServiceDescriptor(catalogService);
    List<CatalogServiceField> catalogServiceFields = catalogServiceManager.getCatalogServiceFields(catalogService.getId());
    return map(catalogService, serviceDescriptor, catalogServiceFields);
}
Also used : CatalogServiceField(com.emc.storageos.db.client.model.uimodels.CatalogServiceField) WorkflowServiceDescriptor(com.emc.sa.catalog.WorkflowServiceDescriptor) ServiceDescriptor(com.emc.sa.descriptor.ServiceDescriptor) CatalogService(com.emc.storageos.db.client.model.uimodels.CatalogService) Path(javax.ws.rs.Path) Produces(javax.ws.rs.Produces) GET(javax.ws.rs.GET)

Example 23 with CatalogService

use of com.emc.storageos.db.client.model.uimodels.CatalogService in project coprhd-controller by CoprHD.

the class CatalogServiceService method updateCatalogService.

/**
 * Update catalog service
 *
 * @param param Catalog Service update parameters
 * @param id the URN the catalog service
 * @prereq none
 * @brief Update Catalog Service
 * @return No data returned in response body
 */
@PUT
@Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
@Path("/{id}")
@CheckPermission(roles = { Role.TENANT_ADMIN }, acls = { ACL.OWN })
public CatalogServiceRestRep updateCatalogService(@PathParam("id") URI id, CatalogServiceUpdateParam param) {
    CatalogService catalogService = getCatalogServiceById(id, true);
    List<CatalogServiceField> catalogServiceFields = catalogServiceManager.getCatalogServiceFields(id);
    StorageOSUser user = getUserFromContext();
    CatalogCategory parentCatalogCategory = catalogCategoryManager.getCatalogCategoryById(param.getCatalogCategory());
    verifyAuthorizedInTenantOrg(uri(parentCatalogCategory.getTenant()), user);
    validateParam(param, catalogService);
    updateObject(catalogService, param, parentCatalogCategory);
    List<CatalogServiceField> updatedCatalogServiceFields = updateObjectList(catalogService, catalogServiceFields, param.getCatalogServiceFields());
    catalogServiceManager.updateCatalogService(catalogService, updatedCatalogServiceFields);
    auditOpSuccess(OperationTypeEnum.UPDATE_CATALOG_SERVICE, catalogService.auditParameters());
    // Refresh Objects
    catalogService = catalogServiceManager.getCatalogServiceById(catalogService.getId());
    catalogServiceFields = catalogServiceManager.getCatalogServiceFields(catalogService.getId());
    ServiceDescriptor serviceDescriptor = getServiceDescriptor(catalogService);
    return map(catalogService, serviceDescriptor, catalogServiceFields);
}
Also used : CatalogServiceField(com.emc.storageos.db.client.model.uimodels.CatalogServiceField) WorkflowServiceDescriptor(com.emc.sa.catalog.WorkflowServiceDescriptor) ServiceDescriptor(com.emc.sa.descriptor.ServiceDescriptor) StorageOSUser(com.emc.storageos.security.authentication.StorageOSUser) CatalogService(com.emc.storageos.db.client.model.uimodels.CatalogService) CatalogCategory(com.emc.storageos.db.client.model.uimodels.CatalogCategory) 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 24 with CatalogService

use of com.emc.storageos.db.client.model.uimodels.CatalogService in project coprhd-controller by CoprHD.

the class CatalogServiceService method getRoleAssignmentsResponse.

private ACLAssignments getRoleAssignmentsResponse(URI id) {
    CatalogService catalogService = catalogServiceManager.getCatalogServiceById(id);
    ACLAssignments response = new ACLAssignments();
    response.setAssignments(_permissionsHelper.convertToACLEntries(catalogService.getAcls()));
    return response;
}
Also used : CatalogService(com.emc.storageos.db.client.model.uimodels.CatalogService) ACLAssignments(com.emc.storageos.model.auth.ACLAssignments)

Example 25 with CatalogService

use of com.emc.storageos.db.client.model.uimodels.CatalogService in project coprhd-controller by CoprHD.

the class CatalogServiceMapper method createNewObject.

public static CatalogService createNewObject(CatalogServiceCreateParam param, CatalogCategory catalogCategory) {
    CatalogService newObject = new CatalogService();
    newObject.setId(URIUtil.createId(CatalogService.class));
    updateObject(newObject, param, catalogCategory);
    return newObject;
}
Also used : CatalogService(com.emc.storageos.db.client.model.uimodels.CatalogService)

Aggregations

CatalogService (com.emc.storageos.db.client.model.uimodels.CatalogService)34 ServiceDescriptor (com.emc.sa.descriptor.ServiceDescriptor)8 URI (java.net.URI)8 NamedURI (com.emc.storageos.db.client.model.NamedURI)7 CatalogCategory (com.emc.storageos.db.client.model.uimodels.CatalogCategory)7 CatalogServiceField (com.emc.storageos.db.client.model.uimodels.CatalogServiceField)6 Path (javax.ws.rs.Path)6 WorkflowServiceDescriptor (com.emc.sa.catalog.WorkflowServiceDescriptor)5 Produces (javax.ws.rs.Produces)5 StorageOSUser (com.emc.storageos.security.authentication.StorageOSUser)4 CheckPermission (com.emc.storageos.security.authorization.CheckPermission)4 Test (org.junit.Test)4 BaseModelTest (com.emc.sa.model.BaseModelTest)3 ExecutionState (com.emc.storageos.db.client.model.uimodels.ExecutionState)3 Order (com.emc.storageos.db.client.model.uimodels.Order)3 OrderParameter (com.emc.storageos.db.client.model.uimodels.OrderParameter)3 Consumes (javax.ws.rs.Consumes)3 ModelClient (com.emc.sa.model.dao.ModelClient)2 CatalogServiceAndFields (com.emc.storageos.db.client.model.uimodels.CatalogServiceAndFields)2 ArrayList (java.util.ArrayList)2