diff --git a/components/apimgt/org.wso2.carbon.apimgt.persistence/src/main/java/org/wso2/carbon/apimgt/persistence/APIConstants.java b/components/apimgt/org.wso2.carbon.apimgt.persistence/src/main/java/org/wso2/carbon/apimgt/persistence/APIConstants.java index 903d2d8d9148..8760316ab35f 100644 --- a/components/apimgt/org.wso2.carbon.apimgt.persistence/src/main/java/org/wso2/carbon/apimgt/persistence/APIConstants.java +++ b/components/apimgt/org.wso2.carbon.apimgt.persistence/src/main/java/org/wso2/carbon/apimgt/persistence/APIConstants.java @@ -51,6 +51,7 @@ public final class APIConstants { public static final String API_OVERVIEW_BUSS_OWNER_EMAIL = "overview_businessOwnerEmail"; public static final String API_OVERVIEW_VISIBILITY = "overview_visibility"; public static final String API_OVERVIEW_VISIBLE_ROLES = "overview_visibleRoles"; + public static final String API_OVERVIEW_VISIBLE_ORGANIZATIONS = "overview_visibleOrganizations"; public static final String API_OVERVIEW_VISIBLE_TENANTS = "overview_visibleTenants"; public static final String API_OVERVIEW_ENVIRONMENTS = "overview_environments"; public static final String API_OVERVIEW_AUDIENCE = "overview_audience"; diff --git a/components/apimgt/org.wso2.carbon.apimgt.persistence/src/main/java/org/wso2/carbon/apimgt/persistence/RegistryPersistenceImpl.java b/components/apimgt/org.wso2.carbon.apimgt.persistence/src/main/java/org/wso2/carbon/apimgt/persistence/RegistryPersistenceImpl.java index fb7a5e98a056..7fb2d77df13f 100644 --- a/components/apimgt/org.wso2.carbon.apimgt.persistence/src/main/java/org/wso2/carbon/apimgt/persistence/RegistryPersistenceImpl.java +++ b/components/apimgt/org.wso2.carbon.apimgt.persistence/src/main/java/org/wso2/carbon/apimgt/persistence/RegistryPersistenceImpl.java @@ -174,16 +174,13 @@ public PublisherAPI addAPI(Organization org, PublisherAPI publisherAPI) throws A visibleRoles = visibleRolesList.split(","); } - String visibleOrgs = APIConstants.DEFAULT_VISIBLE_ORG; - if (!StringUtils.isEmpty(api.getVisibleOrganizations())) { - visibleOrgs = api.getVisibleOrganizations(); - } + String visibleOrgs = getVisibleOrganizations(api.getVisibleOrganizations()); String publisherAccessControlRoles = api.getAccessControlRoles(); updateRegistryResources(registry, artifactPath, publisherAccessControlRoles, api.getAccessControl(), - api.getAdditionalProperties(), visibleOrgs); + api.getAdditionalProperties()); RegistryPersistenceUtil.setResourcePermissions(api.getId().getProviderName(), api.getVisibility(), - visibleRoles, artifactPath, registry); + visibleRoles, artifactPath, registry, visibleOrgs); if (api.getSwaggerDefinition() != null) { String resourcePath = RegistryPersistenceUtil.getOpenAPIDefinitionFilePath(api.getId().getName(), @@ -202,7 +199,7 @@ public PublisherAPI addAPI(Organization org, PublisherAPI publisherAPI) throws A RegistryPersistenceUtil.clearResourcePermissions(resourcePath, api.getId(), ((UserRegistry) registry).getTenantId()); RegistryPersistenceUtil.setResourcePermissions(api.getId().getProviderName(), api.getVisibility(), - visibleRoles, resourcePath); + visibleRoles, resourcePath, visibleOrgs); } if (api.getAsyncApiDefinition() != null) { String resourcePath = RegistryPersistenceUtil @@ -221,7 +218,7 @@ public PublisherAPI addAPI(Organization org, PublisherAPI publisherAPI) throws A RegistryPersistenceUtil.clearResourcePermissions(resourcePath, api.getId(), ((UserRegistry) registry).getTenantId()); RegistryPersistenceUtil.setResourcePermissions(api.getId().getProviderName(), api.getVisibility(), - visibleRoles, resourcePath); + visibleRoles, resourcePath, visibleOrgs); } //Set permissions to doc path @@ -230,7 +227,7 @@ public PublisherAPI addAPI(Organization org, PublisherAPI publisherAPI) throws A RegistryPersistenceUtil.clearResourcePermissions(docLocation, api.getId(), ((UserRegistry) registry).getTenantId()); RegistryPersistenceUtil.setResourcePermissions(api.getId().getProviderName(), api.getVisibility(), - visibleRoles, docLocation); + visibleRoles, docLocation, visibleOrgs); registry.commitTransaction(); api.setUuid(artifact.getId()); @@ -270,6 +267,13 @@ public PublisherAPI addAPI(Organization org, PublisherAPI publisherAPI) throws A } } } + private String getVisibleOrganizations(String orgValue) { + String visibleOrgs = APIConstants.DEFAULT_VISIBLE_ORG; + if (!StringUtils.isEmpty(orgValue)) { + visibleOrgs = orgValue; + } + return visibleOrgs; + } private void applyTags(Set apiTags, Registry registry, String artifactPath) throws APIPersistenceException { @@ -405,7 +409,7 @@ public void restoreAPIRevision(Organization org, String apiUUID, String revision RegistryPersistenceUtil.clearResourcePermissions(apiPath, api.getId(), ((UserRegistry) registry).getTenantId()); RegistryPersistenceUtil.setResourcePermissions(api.getId().getProviderName(), api.getVisibility(), - visibleRoles, apiPath); + visibleRoles, apiPath, getVisibleOrganizations(api.getVisibleOrganizations())); GenericArtifact newArtifact = artifactManager.getGenericArtifact(apiUUID); if (newArtifact != null && newArtifact.getAttribute(APIConstants.API_OVERVIEW_VERSION_COMPARABLE) == null) { if (existingVersionComparable != null) { @@ -561,7 +565,7 @@ public PublisherAPI updateAPI(Organization org, PublisherAPI publisherAPI) throw } updateRegistryResources(registry, artifactPath, publisherAccessControlRoles, api.getAccessControl(), - api.getAdditionalProperties(), visibleOrgs); + api.getAdditionalProperties()); //propagate api status change and access control roles change to document artifact String newStatus = updateApiArtifact.getAttribute(APIConstants.API_OVERVIEW_STATUS); @@ -576,8 +580,9 @@ public PublisherAPI updateAPI(Organization org, PublisherAPI publisherAPI) throw if (visibleRolesList != null) { visibleRoles = visibleRolesList.split(","); } + String visibleOrganizations = getVisibleOrganizations(api.getVisibleOrganizations()); RegistryPersistenceUtil.setResourcePermissions(api.getId().getProviderName(), api.getVisibility(), - visibleRoles, artifactPath, registry); + visibleRoles, artifactPath, registry, visibleOrganizations); //attaching api categories to the API List attachedApiCategories = api.getApiCategories(); @@ -605,7 +610,7 @@ public PublisherAPI updateAPI(Organization org, PublisherAPI publisherAPI) throw RegistryPersistenceUtil.clearResourcePermissions(resourcePath, api.getId(), ((UserRegistry) registry).getTenantId()); RegistryPersistenceUtil.setResourcePermissions(api.getId().getProviderName(), api.getVisibility(), - visibleRoles, resourcePath, registry); + visibleRoles, resourcePath, registry, visibleOrganizations); } // Update api def file permissions, required for API definition content search functionality @@ -618,7 +623,7 @@ public PublisherAPI updateAPI(Organization org, PublisherAPI publisherAPI) throw RegistryPersistenceUtil.clearResourcePermissions(resourcePath, api.getId(), ((UserRegistry) registry).getTenantId()); RegistryPersistenceUtil.setResourcePermissions(api.getId().getProviderName(), api.getVisibility(), - visibleRoles, resourcePath, registry); + visibleRoles, resourcePath, registry, visibleOrganizations); } } else if (api.isAsync()) { String resourcePath = RegistryPersistenceUtil.getOpenAPIDefinitionFilePath(api.getId().getName(), @@ -628,7 +633,7 @@ public PublisherAPI updateAPI(Organization org, PublisherAPI publisherAPI) throw RegistryPersistenceUtil.clearResourcePermissions(resourcePath, api.getId(), ((UserRegistry) registry).getTenantId()); RegistryPersistenceUtil.setResourcePermissions(api.getId().getProviderName(), api.getVisibility(), - visibleRoles, resourcePath, registry); + visibleRoles, resourcePath, registry, visibleOrganizations); } } else if (APIConstants.API_TYPE_SOAP.equals(api.getType())) { String resourcePath = RegistryPersistenceUtil.getOpenAPIDefinitionFilePath(api.getId().getName(), @@ -639,7 +644,7 @@ public PublisherAPI updateAPI(Organization org, PublisherAPI publisherAPI) throw RegistryPersistenceUtil.clearResourcePermissions(resourcePath, api.getId(), ((UserRegistry) registry).getTenantId()); RegistryPersistenceUtil.setResourcePermissions(api.getId().getProviderName(), api.getVisibility(), - visibleRoles, resourcePath, registry); + visibleRoles, resourcePath, registry, visibleOrganizations); } } @@ -674,7 +679,8 @@ public PublisherAPI updateAPI(Organization org, PublisherAPI publisherAPI) throw String documentationPath = RegistryPersistenceDocUtil.getAPIDocPath(api.getId()) + doc.getName(); RegistryPersistenceUtil.setResourcePermissions(api.getId().getProviderName(), - api.getVisibility(), visibleRoles, documentationPath, registry); + api.getVisibility(), visibleRoles, documentationPath, registry, + visibleOrganizations); if (Documentation.DocumentSourceType.INLINE.equals(doc.getSourceType()) || Documentation.DocumentSourceType.MARKDOWN.equals(doc.getSourceType())) { @@ -682,13 +688,14 @@ public PublisherAPI updateAPI(Organization org, PublisherAPI publisherAPI) throw + APIConstants.INLINE_DOCUMENT_CONTENT_DIR + RegistryConstants.PATH_SEPARATOR + doc.getName(); RegistryPersistenceUtil.setResourcePermissions(api.getId().getProviderName(), - api.getVisibility(), visibleRoles, contentPath, registry); + api.getVisibility(), visibleRoles, contentPath, registry, + visibleOrganizations); } else if (Documentation.DocumentSourceType.FILE.equals(doc.getSourceType()) && doc.getFilePath() != null) { String filePath = RegistryPersistenceDocUtil.getDocumentationFilePath(api.getId(), doc.getFilePath().split("files" + RegistryConstants.PATH_SEPARATOR)[1]); RegistryPersistenceUtil.setResourcePermissions(api.getId().getProviderName(), - api.getVisibility(), visibleRoles, filePath, registry); + api.getVisibility(), visibleRoles, filePath, registry, visibleOrganizations); } } } @@ -1962,7 +1969,8 @@ public void saveWSDL(Organization org, String apiId, ResourceFile wsdlResourceFi visibleRoles = visibleRolesList.split(","); } RegistryPersistenceUtil.setResourcePermissions(apiProviderName, visibility, visibleRoles, - wsdlResourcePath, registry); + wsdlResourcePath, registry, getVisibleOrganizations(apiArtifact + .getAttribute(APIConstants.API_OVERVIEW_VISIBLE_ORGANIZATIONS))); if (isZip) { //Delete any WSDL file if exists @@ -2114,7 +2122,8 @@ public void saveOASDefinition(Organization org, String apiId, String apiDefiniti RegistryPersistenceUtil.clearResourcePermissions(resourcePath, new APIIdentifier(apiProviderName, apiName, apiVersion), ((UserRegistry) registry).getTenantId()); RegistryPersistenceUtil.setResourcePermissions(apiProviderName, visibility, visibleRolesArr, - resourcePath, registry); + resourcePath, registry, getVisibleOrganizations(apiArtifact + .getAttribute(APIConstants.API_OVERVIEW_VISIBLE_ORGANIZATIONS))); } catch (RegistryException | APIPersistenceException | APIManagementException e) { throw new OASPersistenceException("Error while adding OSA Definition for " + apiId, e); @@ -2212,7 +2221,8 @@ public void saveAsyncDefinition(Organization org, String apiId, String apiDefini .clearResourcePermissions(resourcePath, new APIIdentifier(apiProviderName, apiName, apiVersion), ((UserRegistry) registry).getTenantId()); RegistryPersistenceUtil.setResourcePermissions(apiProviderName, visibility, visibleRolesArr, resourcePath - , registry); + , registry, getVisibleOrganizations(apiArtifact + .getAttribute(APIConstants.API_OVERVIEW_VISIBLE_ORGANIZATIONS))); } catch (RegistryException | APIPersistenceException | APIManagementException e) { throw new AsyncSpecPersistenceException("Error while adding AsyncApi Definition for " + apiId, e); @@ -2303,7 +2313,7 @@ public void saveGraphQLSchemaDefinition(Organization org, String apiId, String s new APIIdentifier(api.apiProvider, api.apiName, api.apiVersion), ((UserRegistry) registry).getTenantId()); RegistryPersistenceUtil.setResourcePermissions(api.apiProvider, api.visibility, api.visibleRoles, - saveResourcePath, registry); + saveResourcePath, registry, getVisibleOrganizations(api.visibleOrganizations)); } catch (RegistryException | APIManagementException | APIPersistenceException e) { throw new GraphQLPersistenceException("Error while adding Graphql Definition for api " + apiId, e); @@ -2385,8 +2395,10 @@ public Documentation addDocumentation(Organization org, String apiId, Documentat visibility = APIConstants.DOC_OWNER_VISIBILITY; } } + String visibleOrganizations = getVisibleOrganizations(apiArtifact + .getAttribute(APIConstants.API_OVERVIEW_VISIBLE_ORGANIZATIONS)); RegistryPersistenceUtil.setResourcePermissions(apiProviderName, visibility, authorizedRoles, docArtifact - .getPath(), registry); + .getPath(), registry, visibleOrganizations); String docFilePath = docArtifact.getAttribute(APIConstants.DOC_FILE_PATH); if (docFilePath != null && !"".equals(docFilePath)) { // The docFilePatch comes as @@ -2397,7 +2409,7 @@ public Documentation addDocumentation(Organization org, String apiId, Documentat int startIndex = docFilePath.indexOf(APIConstants.GOVERNANCE) + (APIConstants.GOVERNANCE).length(); String filePath = docFilePath.substring(startIndex, docFilePath.length()); RegistryPersistenceUtil.setResourcePermissions(apiProviderName, visibility, authorizedRoles, filePath, - registry); + registry, visibleOrganizations); } } documentation.setId(docArtifact.getId()); @@ -2455,8 +2467,10 @@ public Documentation updateDocumentation(Organization org, String apiId, Documen RegistryPersistenceUtil.clearResourcePermissions(updateApiArtifact.getPath(), new APIIdentifier(apiProviderName, apiName, apiVersion), ((UserRegistry) registry).getTenantId()); + String visibleOrganizations = getVisibleOrganizations(apiArtifact + .getAttribute(APIConstants.API_OVERVIEW_VISIBLE_ORGANIZATIONS)); RegistryPersistenceUtil.setResourcePermissions(apiProviderName, visibility, authorizedRoles, - artifact.getPath(), registry); + artifact.getPath(), registry, visibleOrganizations); String docFilePath = artifact.getAttribute(APIConstants.DOC_FILE_PATH); if (docFilePath != null && !"".equals(docFilePath)) { @@ -2468,7 +2482,7 @@ public Documentation updateDocumentation(Organization org, String apiId, Documen int startIndex = docFilePath.indexOf(APIConstants.GOVERNANCE) + (APIConstants.GOVERNANCE).length(); String filePath = docFilePath.substring(startIndex, docFilePath.length()); RegistryPersistenceUtil.setResourcePermissions(apiProviderName, visibility, authorizedRoles, filePath, - registry); + registry, visibleOrganizations); } return documentation; } catch (RegistryException | APIManagementException | APIPersistenceException e) { @@ -2619,6 +2633,9 @@ public DocumentContent addDocumentationContent(Organization org, String apiId, S apiArtifact.getQName().getLocalPart()); String apiName = apiArtifact.getAttribute(APIConstants.API_OVERVIEW_NAME); String apiVersion = apiArtifact.getAttribute(APIConstants.API_OVERVIEW_VERSION); + String visibleOrganizations = getVisibleOrganizations(apiArtifact + .getAttribute(APIConstants.API_OVERVIEW_VISIBLE_ORGANIZATIONS)); + GenericArtifactManager docArtifactManager = RegistryPersistenceDocUtil .getDocumentArtifactManager(registry); @@ -2637,7 +2654,7 @@ public DocumentContent addDocumentationContent(Organization org, String apiId, S } RegistryPersistenceUtil.setResourcePermissions( RegistryPersistenceUtil.replaceEmailDomain(apiProviderName), visibility, visibleRoles, filePath, - registry); + registry, visibleOrganizations); //documentation.setFilePath(addResourceFile(apiId, filePath, icon)); String savedFilePath = addResourceFile(filePath, resource, registry, tenantDomain); //doc.setFilePath(savedFilePath); @@ -2676,7 +2693,7 @@ public DocumentContent addDocumentationContent(Organization org, String apiId, S } } RegistryPersistenceUtil.setResourcePermissions(apiProviderName, visibility, authorizedRoles, - contentPath, registry); + contentPath, registry, visibleOrganizations); GenericArtifact updateDocArtifact = RegistryPersistenceDocUtil.createDocArtifactContent(docArtifact, apiProviderName, apiName, apiVersion, doc); Boolean toggle = Boolean.parseBoolean(updateDocArtifact.getAttribute("toggle")); @@ -2975,7 +2992,8 @@ public void saveThumbnail(Organization org, String apiId, ResourceFile resourceF String savedFilePath = addResourceFile(filePath, resourceFile, registry, tenantDomain); - RegistryPersistenceUtil.setResourcePermissions(apiProviderName, null, null, filePath); + RegistryPersistenceUtil.setResourcePermissions(apiProviderName, null, null, filePath, + getVisibleOrganizations(apiArtifact.getAttribute(APIConstants.API_OVERVIEW_VISIBLE_ORGANIZATIONS))); apiArtifact.setAttribute(APIConstants.API_OVERVIEW_THUMBNAIL_URL, savedFilePath); apiArtifactManager.updateGenericArtifact(apiArtifact); @@ -3117,7 +3135,7 @@ private void saveAPIStatus(Registry registry, String artifactId, String apiStatu * @throws RegistryException Registry Exception. */ private void updateRegistryResources(Registry registry, String artifactPath, String publisherAccessControlRoles, - String publisherAccessControl, Map additionalProperties, String visibleOrganizations) + String publisherAccessControl, Map additionalProperties) throws RegistryException { publisherAccessControlRoles = (publisherAccessControlRoles == null || publisherAccessControlRoles.trim() .isEmpty()) ? APIConstants.NULL_USER_ROLE_LIST : publisherAccessControlRoles; @@ -3150,10 +3168,6 @@ private void updateRegistryResources(Registry registry, String artifactPath, Str // the roles that were specified can be maintained. apiResource.setProperty(APIConstants.DISPLAY_PUBLISHER_ROLES, publisherAccessControlRoles); apiResource.setProperty(APIConstants.ACCESS_CONTROL, publisherAccessControl); - if (!StringUtils.isEmpty(visibleOrganizations) && visibleOrganizations.contains(" ")) { - visibleOrganizations = visibleOrganizations.replace(" ", "+"); - } - apiResource.setProperty(APIConstants.VISIBLE_ORGANIZATIONS, visibleOrganizations); apiResource.removeProperty(APIConstants.CUSTOM_API_INDEXER_PROPERTY); if (additionalProperties != null && additionalProperties.size() != 0) { for (Map.Entry entry : additionalProperties.entrySet()) { @@ -3351,6 +3365,7 @@ private BasicAPI getbasicAPIInfo(String uuid, Registry registry) if (visibleRolesList != null) { api.visibleRoles = visibleRolesList.split(","); } + api.visibleOrganizations = apiArtifact.getAttribute(APIConstants.API_OVERVIEW_VISIBLE_ORGANIZATIONS); api.visibility = apiArtifact.getAttribute(APIConstants.API_OVERVIEW_VISIBILITY); return api; @@ -3362,6 +3377,7 @@ private class BasicAPI { String apiProvider; String visibility; String[] visibleRoles; + String visibleOrganizations; } @Override @@ -3414,9 +3430,9 @@ public PublisherAPIProduct addAPIProduct(Organization org, PublisherAPIProduct p //visibleOrgs = apiProduct.getVisibleOrganizations(); TODO fix for products // } updateRegistryResources(registry, artifactPath, publisherAccessControlRoles, apiProduct.getAccessControl(), - apiProduct.getAdditionalProperties(), visibleOrgs); + apiProduct.getAdditionalProperties()); RegistryPersistenceUtil.setResourcePermissions(apiProduct.getId().getProviderName(), - apiProduct.getVisibility(), visibleRoles, artifactPath, registry); + apiProduct.getVisibility(), visibleRoles, artifactPath, registry, getVisibleOrganizations(null)); registry.commitTransaction(); transactionCommitted = true; @@ -3644,9 +3660,10 @@ public PublisherAPIProduct updateAPIProduct(Organization org, PublisherAPIProduc //visibleOrgs = apiProduct.getVisibleOrganizations(); TODO fix for products // } updateRegistryResources(registry, artifactPath, publisherAccessControlRoles, apiProduct.getAccessControl(), - apiProduct.getAdditionalProperties(), visibleOrgs); + apiProduct.getAdditionalProperties()); RegistryPersistenceUtil.setResourcePermissions(apiProduct.getId().getProviderName(), - apiProduct.getVisibility(), visibleRoles, artifactPath, registry); + apiProduct.getVisibility(), visibleRoles, artifactPath, registry, + getVisibleOrganizations(null)); registry.commitTransaction(); transactionCommitted = true; return publisherAPIProduct; diff --git a/components/apimgt/org.wso2.carbon.apimgt.persistence/src/main/java/org/wso2/carbon/apimgt/persistence/utils/RegistryPersistenceUtil.java b/components/apimgt/org.wso2.carbon.apimgt.persistence/src/main/java/org/wso2/carbon/apimgt/persistence/utils/RegistryPersistenceUtil.java index a4da31c5f9d8..9be14c23e37b 100644 --- a/components/apimgt/org.wso2.carbon.apimgt.persistence/src/main/java/org/wso2/carbon/apimgt/persistence/utils/RegistryPersistenceUtil.java +++ b/components/apimgt/org.wso2.carbon.apimgt.persistence/src/main/java/org/wso2/carbon/apimgt/persistence/utils/RegistryPersistenceUtil.java @@ -141,6 +141,7 @@ public static GenericArtifact createAPIArtifactContent(GenericArtifact artifact, artifact.setAttribute(APIConstants.API_OVERVIEW_BUSS_OWNER_EMAIL, api.getBusinessOwnerEmail()); artifact.setAttribute(APIConstants.API_OVERVIEW_VISIBILITY, api.getVisibility()); artifact.setAttribute(APIConstants.API_OVERVIEW_VISIBLE_ROLES, api.getVisibleRoles()); + artifact.setAttribute(APIConstants.API_OVERVIEW_VISIBLE_ORGANIZATIONS, api.getVisibleOrganizations()); artifact.setAttribute(APIConstants.API_OVERVIEW_VISIBLE_TENANTS, api.getVisibleTenants()); artifact.setAttribute(APIConstants.API_OVERVIEW_ENDPOINT_SECURED, Boolean.toString(api.isEndpointSecured())); @@ -997,9 +998,9 @@ public static void endTenantFlow() { * @param artifactPath API resource path * @throws APIManagementException Throwing exception */ - public static void setResourcePermissions(String username, String visibility, String[] roles, String artifactPath) - throws APIManagementException { - setResourcePermissions(username, visibility, roles, artifactPath, null); + public static void setResourcePermissions(String username, String visibility, String[] roles, String artifactPath, + String visibleOrganizations) throws APIManagementException { + setResourcePermissions(username, visibility, roles, artifactPath, null, visibleOrganizations); } /** @@ -1012,7 +1013,7 @@ public static void setResourcePermissions(String username, String visibility, St * @throws APIManagementException Throwing exception */ public static void setResourcePermissions(String username, String visibility, String[] roles, String artifactPath, - Registry registry) throws APIManagementException { + Registry registry, String visibleOrganizations) throws APIManagementException { try { String resourcePath = RegistryUtils.getAbsolutePath(RegistryContext.getBaseInstance(), @@ -1043,6 +1044,9 @@ public static void setResourcePermissions(String username, String visibility, St } else { registryResource.setProperty(APIConstants.STORE_VIEW_ROLES, publisherAccessRoles.toString()); } + if (!StringUtils.isEmpty(visibleOrganizations) && visibleOrganizations.contains(" ")) { + visibleOrganizations = visibleOrganizations.replace(" ", "+"); + } } String tenantDomain = MultitenantUtils.getTenantDomain(PersistenceUtil.replaceEmailDomainBack(username)); int tenantId = ServiceReferenceHolder.getInstance().getRealmService(). @@ -1138,6 +1142,7 @@ public static void setResourcePermissions(String username, String visibility, St } if (registryResource != null) { registryResource.setProperty(APIConstants.STORE_VIEW_ROLES, publisherAccessRoles.toString()); + registryResource.setProperty(APIConstants.VISIBLE_ORGANIZATIONS, visibleOrganizations); registry.put(artifactPath, registryResource); }