From aeec938825eeea744b1c95ca3b075c182f20fba7 Mon Sep 17 00:00:00 2001 From: Dmitriy Marmyshev Date: Mon, 25 Jul 2022 15:46:55 +0300 Subject: [PATCH 1/2] =?UTF-8?q?=D0=9F=D1=80=D0=BE=D0=B2=D0=B5=D1=80=D0=BA?= =?UTF-8?q?=D0=B0:=20right-...=20=D0=BD=D0=B5=20=D0=BD=D0=B0=D1=85=D0=BE?= =?UTF-8?q?=D0=B4=D0=B8=D1=82=20=D0=BE=D1=88=D0=B8=D0=B1=D0=BA=D1=83=20?= =?UTF-8?q?=D0=B4=D0=BB=D1=8F=20=D1=80=D0=BE=D0=BB=D0=B8=20=D1=81=20=D0=B2?= =?UTF-8?q?=D0=BA=D0=BB=D1=8E=D1=87=D0=B5=D0=BD=D0=B8=D0=B5=D0=BC=20=D0=BF?= =?UTF-8?q?=D0=BE=20=D1=83=D0=BC=D0=BE=D0=BB=D1=87=D0=B0=D0=BD=D0=B8=D1=8E?= =?UTF-8?q?=20#815?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 1 + .../META-INF/MANIFEST.MF | 4 + bundles/com.e1c.v8codestyle.right/plugin.xml | 6 +- .../internal/right/CorePlugin.java | 2 +- .../right/ExternalDependenciesModule.java | 12 + .../right/InternalRightInfosService.java | 89 ++++ .../internal/right/ServiceModule.java | 48 +++ .../right/check/RightActiveUsers.java | 13 +- .../right/check/RightAdministration.java | 13 +- .../right/check/RightAllFunctionsMode.java | 13 +- ...ConfigurationExtensionsAdministration.java | 14 +- .../right/check/RightDataAdministration.java | 13 +- .../right/check/RightExclusiveMode.java | 13 +- ...activeClearDeletionMarkPredefinedData.java | 12 +- ...elete.java => RightInteractiveDelete.java} | 13 +- ...nteractiveDeleteMarkedPredefinedData.java} | 14 +- ...RightInteractiveDeletePredefinedData.java} | 13 +- ...InteractiveOpenExternalDataProcessors.java | 14 +- .../RightInteractiveOpenExternalReports.java | 13 +- ...eractiveSetDeletionMarkPredefinedData.java | 12 +- .../RightOutputToPrinterFileClipboard.java | 13 +- .../right/check/RightSaveUserData.java | 13 +- .../right/check/RightStartAutomation.java | 13 +- .../check/RightStartExternalConnection.java | 13 +- .../right/check/RightStartThickClient.java | 13 +- .../right/check/RightStartThinClient.java | 13 +- .../right/check/RightStartWebClient.java | 13 +- .../RightUpdateDatabaseConfiguration.java | 13 +- .../right/check/RightViewEventLog.java | 14 +- .../right/check/RoleRightSetCheck.java | 398 ++++++++++++++++-- .../itests/RoleRightHasForbiddenTest.java | 54 ++- 31 files changed, 765 insertions(+), 137 deletions(-) create mode 100644 bundles/com.e1c.v8codestyle.right/src/com/e1c/v8codestyle/internal/right/InternalRightInfosService.java create mode 100644 bundles/com.e1c.v8codestyle.right/src/com/e1c/v8codestyle/internal/right/ServiceModule.java rename bundles/com.e1c.v8codestyle.right/src/com/e1c/v8codestyle/right/check/{RightInteracitveDelete.java => RightInteractiveDelete.java} (71%) rename bundles/com.e1c.v8codestyle.right/src/com/e1c/v8codestyle/right/check/{RightInteracitveDeleteMarkedPredefinedData.java => RightInteractiveDeleteMarkedPredefinedData.java} (71%) rename bundles/com.e1c.v8codestyle.right/src/com/e1c/v8codestyle/right/check/{RightInteracitveDeletePredefinedData.java => RightInteractiveDeletePredefinedData.java} (71%) diff --git a/CHANGELOG.md b/CHANGELOG.md index 839ae1da..3fc8b131 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -76,6 +76,7 @@ - Ложное срабатывание проверки: statement-type-change для типов общего модуля #994 - Некорректное сообщение об ошибке в строгих типах. Не существует типа "Таблица" #1055 - Ложное сообщение об ошибке о неиспользовании составных типов для стандартных объектов метаданных #1069 +- Проверка: right-... не находит ошибку для роли с включением по умолчанию #815 ## 0.2.0 diff --git a/bundles/com.e1c.v8codestyle.right/META-INF/MANIFEST.MF b/bundles/com.e1c.v8codestyle.right/META-INF/MANIFEST.MF index 8109c9fc..f744c046 100644 --- a/bundles/com.e1c.v8codestyle.right/META-INF/MANIFEST.MF +++ b/bundles/com.e1c.v8codestyle.right/META-INF/MANIFEST.MF @@ -16,13 +16,17 @@ Bundle-Localization: plugin Import-Package: com._1c.g5.v8.bm.core;version="[7.0.0,8.0.0)", com._1c.g5.v8.bm.core.event;version="[2.1.0,3.0.0)", com._1c.g5.v8.bm.integration;version="[10.0.0,11.0.0)", + com._1c.g5.v8.dt.bm.index.emf;version="[7.0.0,8.0.0)", + com._1c.g5.v8.dt.bm.index.rights;version="[5.0.0,6.0.0)", com._1c.g5.v8.dt.common;version="[6.0.0,7.0.0)", com._1c.g5.v8.dt.core.platform;version="[10.0.0,11.0.0)", com._1c.g5.v8.dt.mcore;version="[6.0.0,7.0.0)", com._1c.g5.v8.dt.md;version="[17.0.0,18.0.0)", com._1c.g5.v8.dt.metadata.mdclass;version="[8.0.0,9.0.0)", + com._1c.g5.v8.dt.platform.version;version="[2.0.0,3.0.0)", com._1c.g5.v8.dt.rights.model;version="[4.0.0,5.0.0)", com._1c.g5.v8.dt.rights.model.util;version="[6.0.0,7.0.0)", + com._1c.g5.v8.dt.rights.ui.editors.controllers;version="[4.0.0,5.0.0)", com._1c.g5.wiring;version="[2.2.0,3.0.0)", com._1c.g5.wiring.binder;version="[1.1.0,2.0.0)", com.e1c.g5.v8.dt.check;version="[2.0.0,3.0.0)", diff --git a/bundles/com.e1c.v8codestyle.right/plugin.xml b/bundles/com.e1c.v8codestyle.right/plugin.xml index bf7c3816..441016ca 100644 --- a/bundles/com.e1c.v8codestyle.right/plugin.xml +++ b/bundles/com.e1c.v8codestyle.right/plugin.xml @@ -25,15 +25,15 @@ + class="com.e1c.v8codestyle.internal.right.ExecutableExtensionFactory:com.e1c.v8codestyle.right.check.RightInteractiveDelete"> + class="com.e1c.v8codestyle.internal.right.ExecutableExtensionFactory:com.e1c.v8codestyle.right.check.RightInteractiveDeletePredefinedData"> + class="com.e1c.v8codestyle.internal.right.ExecutableExtensionFactory:com.e1c.v8codestyle.right.check.RightInteractiveDeleteMarkedPredefinedData"> + * FIXME Replace this service after refactoring of {@link IRightInfosService}. + * + * @author Dmitriy Marmyshev + */ +@Singleton +public class InternalRightInfosService +{ + + private final IRuntimeVersionSupport runtimeVersionSupport; + + private final IConfigurationProvider configurationProvider; + + private final Provider rightInfosServiceProvider; + + private final Map infos = new ConcurrentHashMap<>(); + + @Inject + public InternalRightInfosService(IRuntimeVersionSupport runtimeVersionSupport, + IConfigurationProvider configurationProvider, Provider rightInfosServiceProvider) + { + this.runtimeVersionSupport = runtimeVersionSupport; + this.configurationProvider = configurationProvider; + this.rightInfosServiceProvider = rightInfosServiceProvider; + } + + /** + * Gets the rights of some {@link EClass} of configuration metadata object that may has some rights. + * + * @param eClass the {@link EClass} of configuration metadata object that has some rights, cannot be {@code null}. + * @param context the context object of the configuration to determine platform version, cannot be {@code null}. + * @return the rights of the {@link EClass} + */ + public Set getEClassRights(EClass eClass, EObject context) + { + + Version version = runtimeVersionSupport.getRuntimeVersionOrDefault(context, Version.LATEST); + + IRightInfosService info = infos.computeIfAbsent(version, v -> { + + IRightInfosService service = rightInfosServiceProvider.get(); + Configuration configuration = configurationProvider.getConfiguration(context); + service.init(configuration); + + return service; + }); + + if (info == null) + { + return Collections.emptySet(); + } + return info.getEClassRights(eClass); + } +} diff --git a/bundles/com.e1c.v8codestyle.right/src/com/e1c/v8codestyle/internal/right/ServiceModule.java b/bundles/com.e1c.v8codestyle.right/src/com/e1c/v8codestyle/internal/right/ServiceModule.java new file mode 100644 index 00000000..d0d8d77a --- /dev/null +++ b/bundles/com.e1c.v8codestyle.right/src/com/e1c/v8codestyle/internal/right/ServiceModule.java @@ -0,0 +1,48 @@ +/******************************************************************************* + * Copyright (C) 2022, 1C-Soft LLC and others. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * 1C-Soft LLC - initial API and implementation + *******************************************************************************/ +package com.e1c.v8codestyle.internal.right; + +import com._1c.g5.v8.dt.rights.ui.editors.controllers.IRightInfosService; +import com.google.inject.AbstractModule; + +/** + * The internal service module. + * + * @author Dmitriy Marmyshev + */ +public class ServiceModule + extends AbstractModule +{ + private static final String SERVICE_CLASS = "com._1c.g5.v8.dt.internal.rights.ui.editors.RightsInfoService"; //$NON-NLS-1$ + + @SuppressWarnings("unchecked") + @Override + protected void configure() + { + + // XXX remove this when the IRightInfosService become OSGi service + Class clazz = null; + try + { + clazz = (Class)Class.forName(SERVICE_CLASS, true, + IRightInfosService.class.getClassLoader()); + } + catch (ClassNotFoundException e) + { + CorePlugin.logError(e); + } + // Here create new instance every time - this allows to bind it to specific platform Version + // See com.e1c.v8codestyle.internal.right.InternalRightInfosService for details. + bind(IRightInfosService.class).to(clazz); + } +} diff --git a/bundles/com.e1c.v8codestyle.right/src/com/e1c/v8codestyle/right/check/RightActiveUsers.java b/bundles/com.e1c.v8codestyle.right/src/com/e1c/v8codestyle/right/check/RightActiveUsers.java index 4ebe1cb3..ee57c3c8 100644 --- a/bundles/com.e1c.v8codestyle.right/src/com/e1c/v8codestyle/right/check/RightActiveUsers.java +++ b/bundles/com.e1c.v8codestyle.right/src/com/e1c/v8codestyle/right/check/RightActiveUsers.java @@ -14,11 +14,15 @@ package com.e1c.v8codestyle.right.check; import java.util.List; +import com._1c.g5.v8.dt.bm.index.emf.IBmEmfIndexManager; +import com._1c.g5.v8.dt.bm.index.rights.IBmRightsIndexManager; import com._1c.g5.v8.dt.core.platform.IBmModelManager; +import com._1c.g5.v8.dt.core.platform.IResourceLookup; import com._1c.g5.v8.dt.core.platform.IV8ProjectManager; import com._1c.g5.v8.dt.rights.model.util.RightName; import com.e1c.v8codestyle.check.StandardCheckExtension; import com.e1c.v8codestyle.internal.right.CorePlugin; +import com.e1c.v8codestyle.internal.right.InternalRightInfosService; import com.google.inject.Inject; /** @@ -40,9 +44,12 @@ public class RightActiveUsers * {@inheritDoc} */ @Inject - public RightActiveUsers(IV8ProjectManager v8ProjectManager, IBmModelManager bmModelManager) + public RightActiveUsers(IResourceLookup resourceLookup, IV8ProjectManager v8ProjectManager, + IBmModelManager bmModelManager, IBmRightsIndexManager bmRightsIndexManager, + IBmEmfIndexManager bmEmfIndexManager, InternalRightInfosService rightInfosService) { - super(v8ProjectManager, bmModelManager); + super(resourceLookup, v8ProjectManager, bmModelManager, bmRightsIndexManager, bmEmfIndexManager, + rightInfosService); } @Override @@ -55,7 +62,7 @@ public class RightActiveUsers protected void configureCheck(CheckConfigurer builder) { super.configureCheck(builder); - builder.extension(new ExcludeRoleByNameListExtension(NAMES_DEFAULT, bmModelManager)) + builder.extension(new ExcludeRoleByNameListExtension(NAMES_DEFAULT, getBmModelManager())) .extension(new StandardCheckExtension(getCheckId(), CorePlugin.PLUGIN_ID)) .title(Messages.RightActiveUsers_title) .description(Messages.RightActiveUsers_description); diff --git a/bundles/com.e1c.v8codestyle.right/src/com/e1c/v8codestyle/right/check/RightAdministration.java b/bundles/com.e1c.v8codestyle.right/src/com/e1c/v8codestyle/right/check/RightAdministration.java index f075ceb1..80949b3d 100644 --- a/bundles/com.e1c.v8codestyle.right/src/com/e1c/v8codestyle/right/check/RightAdministration.java +++ b/bundles/com.e1c.v8codestyle.right/src/com/e1c/v8codestyle/right/check/RightAdministration.java @@ -14,11 +14,15 @@ package com.e1c.v8codestyle.right.check; import java.util.List; +import com._1c.g5.v8.dt.bm.index.emf.IBmEmfIndexManager; +import com._1c.g5.v8.dt.bm.index.rights.IBmRightsIndexManager; import com._1c.g5.v8.dt.core.platform.IBmModelManager; +import com._1c.g5.v8.dt.core.platform.IResourceLookup; import com._1c.g5.v8.dt.core.platform.IV8ProjectManager; import com._1c.g5.v8.dt.rights.model.util.RightName; import com.e1c.v8codestyle.check.StandardCheckExtension; import com.e1c.v8codestyle.internal.right.CorePlugin; +import com.e1c.v8codestyle.internal.right.InternalRightInfosService; import com.google.inject.Inject; /** @@ -40,9 +44,12 @@ public class RightAdministration * {@inheritDoc} */ @Inject - public RightAdministration(IV8ProjectManager v8ProjectManager, IBmModelManager bmModelManager) + public RightAdministration(IResourceLookup resourceLookup, IV8ProjectManager v8ProjectManager, + IBmModelManager bmModelManager, IBmRightsIndexManager bmRightsIndexManager, + IBmEmfIndexManager bmEmfIndexManager, InternalRightInfosService rightInfosService) { - super(v8ProjectManager, bmModelManager); + super(resourceLookup, v8ProjectManager, bmModelManager, bmRightsIndexManager, bmEmfIndexManager, + rightInfosService); } @Override @@ -55,7 +62,7 @@ public class RightAdministration protected void configureCheck(CheckConfigurer builder) { super.configureCheck(builder); - builder.extension(new ExcludeRoleByNameListExtension(NAMES_DEFAULT, bmModelManager)) + builder.extension(new ExcludeRoleByNameListExtension(NAMES_DEFAULT, getBmModelManager())) .extension(new StandardCheckExtension(getCheckId(), CorePlugin.PLUGIN_ID)) .title(Messages.RightAdministration_title) .description(Messages.RightAdministration_description); diff --git a/bundles/com.e1c.v8codestyle.right/src/com/e1c/v8codestyle/right/check/RightAllFunctionsMode.java b/bundles/com.e1c.v8codestyle.right/src/com/e1c/v8codestyle/right/check/RightAllFunctionsMode.java index 7d252c8a..99bfdaa8 100644 --- a/bundles/com.e1c.v8codestyle.right/src/com/e1c/v8codestyle/right/check/RightAllFunctionsMode.java +++ b/bundles/com.e1c.v8codestyle.right/src/com/e1c/v8codestyle/right/check/RightAllFunctionsMode.java @@ -14,11 +14,15 @@ package com.e1c.v8codestyle.right.check; import java.util.List; +import com._1c.g5.v8.dt.bm.index.emf.IBmEmfIndexManager; +import com._1c.g5.v8.dt.bm.index.rights.IBmRightsIndexManager; import com._1c.g5.v8.dt.core.platform.IBmModelManager; +import com._1c.g5.v8.dt.core.platform.IResourceLookup; import com._1c.g5.v8.dt.core.platform.IV8ProjectManager; import com._1c.g5.v8.dt.rights.model.util.RightName; import com.e1c.v8codestyle.check.StandardCheckExtension; import com.e1c.v8codestyle.internal.right.CorePlugin; +import com.e1c.v8codestyle.internal.right.InternalRightInfosService; import com.google.inject.Inject; /** @@ -40,9 +44,12 @@ public class RightAllFunctionsMode * {@inheritDoc} */ @Inject - public RightAllFunctionsMode(IV8ProjectManager v8ProjectManager, IBmModelManager bmModelManager) + public RightAllFunctionsMode(IResourceLookup resourceLookup, IV8ProjectManager v8ProjectManager, + IBmModelManager bmModelManager, IBmRightsIndexManager bmRightsIndexManager, + IBmEmfIndexManager bmEmfIndexManager, InternalRightInfosService rightInfosService) { - super(v8ProjectManager, bmModelManager); + super(resourceLookup, v8ProjectManager, bmModelManager, bmRightsIndexManager, bmEmfIndexManager, + rightInfosService); } @Override @@ -55,7 +62,7 @@ public class RightAllFunctionsMode protected void configureCheck(CheckConfigurer builder) { super.configureCheck(builder); - builder.extension(new ExcludeRoleByNameListExtension(NAMES_DEFAULT, bmModelManager)) + builder.extension(new ExcludeRoleByNameListExtension(NAMES_DEFAULT, getBmModelManager())) .extension(new StandardCheckExtension(getCheckId(), CorePlugin.PLUGIN_ID)) .title(Messages.RightAllFunctionsMode_title) .description(Messages.RightAllFunctionsMode_description); diff --git a/bundles/com.e1c.v8codestyle.right/src/com/e1c/v8codestyle/right/check/RightConfigurationExtensionsAdministration.java b/bundles/com.e1c.v8codestyle.right/src/com/e1c/v8codestyle/right/check/RightConfigurationExtensionsAdministration.java index 5d44701f..39b028c3 100644 --- a/bundles/com.e1c.v8codestyle.right/src/com/e1c/v8codestyle/right/check/RightConfigurationExtensionsAdministration.java +++ b/bundles/com.e1c.v8codestyle.right/src/com/e1c/v8codestyle/right/check/RightConfigurationExtensionsAdministration.java @@ -14,11 +14,15 @@ package com.e1c.v8codestyle.right.check; import java.util.List; +import com._1c.g5.v8.dt.bm.index.emf.IBmEmfIndexManager; +import com._1c.g5.v8.dt.bm.index.rights.IBmRightsIndexManager; import com._1c.g5.v8.dt.core.platform.IBmModelManager; +import com._1c.g5.v8.dt.core.platform.IResourceLookup; import com._1c.g5.v8.dt.core.platform.IV8ProjectManager; import com._1c.g5.v8.dt.rights.model.util.RightName; import com.e1c.v8codestyle.check.StandardCheckExtension; import com.e1c.v8codestyle.internal.right.CorePlugin; +import com.e1c.v8codestyle.internal.right.InternalRightInfosService; import com.google.inject.Inject; /** @@ -40,10 +44,12 @@ public class RightConfigurationExtensionsAdministration * {@inheritDoc} */ @Inject - public RightConfigurationExtensionsAdministration(IV8ProjectManager v8ProjectManager, - IBmModelManager bmModelManager) + public RightConfigurationExtensionsAdministration(IResourceLookup resourceLookup, + IV8ProjectManager v8ProjectManager, IBmModelManager bmModelManager, IBmRightsIndexManager bmRightsIndexManager, + IBmEmfIndexManager bmEmfIndexManager, InternalRightInfosService rightInfosService) { - super(v8ProjectManager, bmModelManager); + super(resourceLookup, v8ProjectManager, bmModelManager, bmRightsIndexManager, bmEmfIndexManager, + rightInfosService); } @Override @@ -56,7 +62,7 @@ public class RightConfigurationExtensionsAdministration protected void configureCheck(CheckConfigurer builder) { super.configureCheck(builder); - builder.extension(new ExcludeRoleByNameListExtension(NAMES_DEFAULT, bmModelManager)) + builder.extension(new ExcludeRoleByNameListExtension(NAMES_DEFAULT, getBmModelManager())) .extension(new StandardCheckExtension(getCheckId(), CorePlugin.PLUGIN_ID)) .title(Messages.RightConfigurationExtensionsAdministration_title) .description(Messages.RightConfigurationExtensionsAdministration_description); diff --git a/bundles/com.e1c.v8codestyle.right/src/com/e1c/v8codestyle/right/check/RightDataAdministration.java b/bundles/com.e1c.v8codestyle.right/src/com/e1c/v8codestyle/right/check/RightDataAdministration.java index 2a49f69a..1951dba0 100644 --- a/bundles/com.e1c.v8codestyle.right/src/com/e1c/v8codestyle/right/check/RightDataAdministration.java +++ b/bundles/com.e1c.v8codestyle.right/src/com/e1c/v8codestyle/right/check/RightDataAdministration.java @@ -14,11 +14,15 @@ package com.e1c.v8codestyle.right.check; import java.util.List; +import com._1c.g5.v8.dt.bm.index.emf.IBmEmfIndexManager; +import com._1c.g5.v8.dt.bm.index.rights.IBmRightsIndexManager; import com._1c.g5.v8.dt.core.platform.IBmModelManager; +import com._1c.g5.v8.dt.core.platform.IResourceLookup; import com._1c.g5.v8.dt.core.platform.IV8ProjectManager; import com._1c.g5.v8.dt.rights.model.util.RightName; import com.e1c.v8codestyle.check.StandardCheckExtension; import com.e1c.v8codestyle.internal.right.CorePlugin; +import com.e1c.v8codestyle.internal.right.InternalRightInfosService; import com.google.inject.Inject; /** @@ -40,9 +44,12 @@ public class RightDataAdministration * {@inheritDoc} */ @Inject - public RightDataAdministration(IV8ProjectManager v8ProjectManager, IBmModelManager bmModelManager) + public RightDataAdministration(IResourceLookup resourceLookup, IV8ProjectManager v8ProjectManager, + IBmModelManager bmModelManager, IBmRightsIndexManager bmRightsIndexManager, + IBmEmfIndexManager bmEmfIndexManager, InternalRightInfosService rightInfosService) { - super(v8ProjectManager, bmModelManager); + super(resourceLookup, v8ProjectManager, bmModelManager, bmRightsIndexManager, bmEmfIndexManager, + rightInfosService); } @Override @@ -55,7 +62,7 @@ public class RightDataAdministration protected void configureCheck(CheckConfigurer builder) { super.configureCheck(builder); - builder.extension(new ExcludeRoleByNameListExtension(NAMES_DEFAULT, bmModelManager)) + builder.extension(new ExcludeRoleByNameListExtension(NAMES_DEFAULT, getBmModelManager())) .extension(new StandardCheckExtension(getCheckId(), CorePlugin.PLUGIN_ID)) .title(Messages.RightDataAdministration_title) .description(Messages.RightDataAdministration_description); diff --git a/bundles/com.e1c.v8codestyle.right/src/com/e1c/v8codestyle/right/check/RightExclusiveMode.java b/bundles/com.e1c.v8codestyle.right/src/com/e1c/v8codestyle/right/check/RightExclusiveMode.java index 99ecd358..0a935fa4 100644 --- a/bundles/com.e1c.v8codestyle.right/src/com/e1c/v8codestyle/right/check/RightExclusiveMode.java +++ b/bundles/com.e1c.v8codestyle.right/src/com/e1c/v8codestyle/right/check/RightExclusiveMode.java @@ -14,11 +14,15 @@ package com.e1c.v8codestyle.right.check; import java.util.List; +import com._1c.g5.v8.dt.bm.index.emf.IBmEmfIndexManager; +import com._1c.g5.v8.dt.bm.index.rights.IBmRightsIndexManager; import com._1c.g5.v8.dt.core.platform.IBmModelManager; +import com._1c.g5.v8.dt.core.platform.IResourceLookup; import com._1c.g5.v8.dt.core.platform.IV8ProjectManager; import com._1c.g5.v8.dt.rights.model.util.RightName; import com.e1c.v8codestyle.check.StandardCheckExtension; import com.e1c.v8codestyle.internal.right.CorePlugin; +import com.e1c.v8codestyle.internal.right.InternalRightInfosService; import com.google.inject.Inject; /** @@ -42,9 +46,12 @@ public class RightExclusiveMode * @param bmModelManager the BM model manager, cannot be {@code null}. */ @Inject - public RightExclusiveMode(IV8ProjectManager v8ProjectManager, IBmModelManager bmModelManager) + public RightExclusiveMode(IResourceLookup resourceLookup, IV8ProjectManager v8ProjectManager, + IBmModelManager bmModelManager, IBmRightsIndexManager bmRightsIndexManager, + IBmEmfIndexManager bmEmfIndexManager, InternalRightInfosService rightInfosService) { - super(v8ProjectManager, bmModelManager); + super(resourceLookup, v8ProjectManager, bmModelManager, bmRightsIndexManager, bmEmfIndexManager, + rightInfosService); } @Override @@ -57,7 +64,7 @@ public class RightExclusiveMode protected void configureCheck(CheckConfigurer builder) { super.configureCheck(builder); - builder.extension(new ExcludeRoleByNameListExtension(NAMES_DEFAULT, bmModelManager)) + builder.extension(new ExcludeRoleByNameListExtension(NAMES_DEFAULT, getBmModelManager())) .extension(new StandardCheckExtension(getCheckId(), CorePlugin.PLUGIN_ID)) .title(Messages.RightExclusiveMode_title) .description(Messages.RightExclusiveMode_description); diff --git a/bundles/com.e1c.v8codestyle.right/src/com/e1c/v8codestyle/right/check/RightInteractiveClearDeletionMarkPredefinedData.java b/bundles/com.e1c.v8codestyle.right/src/com/e1c/v8codestyle/right/check/RightInteractiveClearDeletionMarkPredefinedData.java index 9d000ffc..3c31c63c 100644 --- a/bundles/com.e1c.v8codestyle.right/src/com/e1c/v8codestyle/right/check/RightInteractiveClearDeletionMarkPredefinedData.java +++ b/bundles/com.e1c.v8codestyle.right/src/com/e1c/v8codestyle/right/check/RightInteractiveClearDeletionMarkPredefinedData.java @@ -13,9 +13,13 @@ *******************************************************************************/ package com.e1c.v8codestyle.right.check; +import com._1c.g5.v8.dt.bm.index.emf.IBmEmfIndexManager; +import com._1c.g5.v8.dt.bm.index.rights.IBmRightsIndexManager; import com._1c.g5.v8.dt.core.platform.IBmModelManager; +import com._1c.g5.v8.dt.core.platform.IResourceLookup; import com._1c.g5.v8.dt.core.platform.IV8ProjectManager; import com._1c.g5.v8.dt.rights.model.util.RightName; +import com.e1c.v8codestyle.internal.right.InternalRightInfosService; import com.e1c.v8codestyle.check.StandardCheckExtension; import com.e1c.v8codestyle.internal.right.CorePlugin; import com.google.inject.Inject; @@ -36,10 +40,12 @@ public class RightInteractiveClearDeletionMarkPredefinedData * {@inheritDoc} */ @Inject - public RightInteractiveClearDeletionMarkPredefinedData(IV8ProjectManager v8ProjectManager, - IBmModelManager bmModelManager) + public RightInteractiveClearDeletionMarkPredefinedData(IResourceLookup resourceLookup, + IV8ProjectManager v8ProjectManager, IBmModelManager bmModelManager, IBmRightsIndexManager bmRightsIndexManager, + IBmEmfIndexManager bmEmfIndexManager, InternalRightInfosService rightInfosService) { - super(v8ProjectManager, bmModelManager); + super(resourceLookup, v8ProjectManager, bmModelManager, bmRightsIndexManager, bmEmfIndexManager, + rightInfosService); } @Override diff --git a/bundles/com.e1c.v8codestyle.right/src/com/e1c/v8codestyle/right/check/RightInteracitveDelete.java b/bundles/com.e1c.v8codestyle.right/src/com/e1c/v8codestyle/right/check/RightInteractiveDelete.java similarity index 71% rename from bundles/com.e1c.v8codestyle.right/src/com/e1c/v8codestyle/right/check/RightInteracitveDelete.java rename to bundles/com.e1c.v8codestyle.right/src/com/e1c/v8codestyle/right/check/RightInteractiveDelete.java index 4cfbcbe8..904fb82c 100644 --- a/bundles/com.e1c.v8codestyle.right/src/com/e1c/v8codestyle/right/check/RightInteracitveDelete.java +++ b/bundles/com.e1c.v8codestyle.right/src/com/e1c/v8codestyle/right/check/RightInteractiveDelete.java @@ -13,9 +13,13 @@ *******************************************************************************/ package com.e1c.v8codestyle.right.check; +import com._1c.g5.v8.dt.bm.index.emf.IBmEmfIndexManager; +import com._1c.g5.v8.dt.bm.index.rights.IBmRightsIndexManager; import com._1c.g5.v8.dt.core.platform.IBmModelManager; +import com._1c.g5.v8.dt.core.platform.IResourceLookup; import com._1c.g5.v8.dt.core.platform.IV8ProjectManager; import com._1c.g5.v8.dt.rights.model.util.RightName; +import com.e1c.v8codestyle.internal.right.InternalRightInfosService; import com.e1c.v8codestyle.check.StandardCheckExtension; import com.e1c.v8codestyle.internal.right.CorePlugin; import com.google.inject.Inject; @@ -26,7 +30,7 @@ import com.google.inject.Inject; * @author Dmitriy Marmyshev * */ -public class RightInteracitveDelete +public class RightInteractiveDelete extends RoleRightSetCheck { @@ -36,9 +40,12 @@ public class RightInteracitveDelete * {@inheritDoc} */ @Inject - public RightInteracitveDelete(IV8ProjectManager v8ProjectManager, IBmModelManager bmModelManager) + public RightInteractiveDelete(IResourceLookup resourceLookup, IV8ProjectManager v8ProjectManager, + IBmModelManager bmModelManager, IBmRightsIndexManager bmRightsIndexManager, + IBmEmfIndexManager bmEmfIndexManager, InternalRightInfosService rightInfosService) { - super(v8ProjectManager, bmModelManager); + super(resourceLookup, v8ProjectManager, bmModelManager, bmRightsIndexManager, bmEmfIndexManager, + rightInfosService); } @Override diff --git a/bundles/com.e1c.v8codestyle.right/src/com/e1c/v8codestyle/right/check/RightInteracitveDeleteMarkedPredefinedData.java b/bundles/com.e1c.v8codestyle.right/src/com/e1c/v8codestyle/right/check/RightInteractiveDeleteMarkedPredefinedData.java similarity index 71% rename from bundles/com.e1c.v8codestyle.right/src/com/e1c/v8codestyle/right/check/RightInteracitveDeleteMarkedPredefinedData.java rename to bundles/com.e1c.v8codestyle.right/src/com/e1c/v8codestyle/right/check/RightInteractiveDeleteMarkedPredefinedData.java index 9ca47b53..dbd9671c 100644 --- a/bundles/com.e1c.v8codestyle.right/src/com/e1c/v8codestyle/right/check/RightInteracitveDeleteMarkedPredefinedData.java +++ b/bundles/com.e1c.v8codestyle.right/src/com/e1c/v8codestyle/right/check/RightInteractiveDeleteMarkedPredefinedData.java @@ -13,9 +13,13 @@ *******************************************************************************/ package com.e1c.v8codestyle.right.check; +import com._1c.g5.v8.dt.bm.index.emf.IBmEmfIndexManager; +import com._1c.g5.v8.dt.bm.index.rights.IBmRightsIndexManager; import com._1c.g5.v8.dt.core.platform.IBmModelManager; +import com._1c.g5.v8.dt.core.platform.IResourceLookup; import com._1c.g5.v8.dt.core.platform.IV8ProjectManager; import com._1c.g5.v8.dt.rights.model.util.RightName; +import com.e1c.v8codestyle.internal.right.InternalRightInfosService; import com.e1c.v8codestyle.check.StandardCheckExtension; import com.e1c.v8codestyle.internal.right.CorePlugin; import com.google.inject.Inject; @@ -26,7 +30,7 @@ import com.google.inject.Inject; * @author Dmitriy Marmyshev * */ -public class RightInteracitveDeleteMarkedPredefinedData +public class RightInteractiveDeleteMarkedPredefinedData extends RoleRightSetCheck { @@ -36,10 +40,12 @@ public class RightInteracitveDeleteMarkedPredefinedData * {@inheritDoc} */ @Inject - public RightInteracitveDeleteMarkedPredefinedData(IV8ProjectManager v8ProjectManager, - IBmModelManager bmModelManager) + public RightInteractiveDeleteMarkedPredefinedData(IResourceLookup resourceLookup, + IV8ProjectManager v8ProjectManager, IBmModelManager bmModelManager, IBmRightsIndexManager bmRightsIndexManager, + IBmEmfIndexManager bmEmfIndexManager, InternalRightInfosService rightInfosService) { - super(v8ProjectManager, bmModelManager); + super(resourceLookup, v8ProjectManager, bmModelManager, bmRightsIndexManager, bmEmfIndexManager, + rightInfosService); } @Override diff --git a/bundles/com.e1c.v8codestyle.right/src/com/e1c/v8codestyle/right/check/RightInteracitveDeletePredefinedData.java b/bundles/com.e1c.v8codestyle.right/src/com/e1c/v8codestyle/right/check/RightInteractiveDeletePredefinedData.java similarity index 71% rename from bundles/com.e1c.v8codestyle.right/src/com/e1c/v8codestyle/right/check/RightInteracitveDeletePredefinedData.java rename to bundles/com.e1c.v8codestyle.right/src/com/e1c/v8codestyle/right/check/RightInteractiveDeletePredefinedData.java index bb2d5a8f..f9961a1d 100644 --- a/bundles/com.e1c.v8codestyle.right/src/com/e1c/v8codestyle/right/check/RightInteracitveDeletePredefinedData.java +++ b/bundles/com.e1c.v8codestyle.right/src/com/e1c/v8codestyle/right/check/RightInteractiveDeletePredefinedData.java @@ -13,9 +13,13 @@ *******************************************************************************/ package com.e1c.v8codestyle.right.check; +import com._1c.g5.v8.dt.bm.index.emf.IBmEmfIndexManager; +import com._1c.g5.v8.dt.bm.index.rights.IBmRightsIndexManager; import com._1c.g5.v8.dt.core.platform.IBmModelManager; +import com._1c.g5.v8.dt.core.platform.IResourceLookup; import com._1c.g5.v8.dt.core.platform.IV8ProjectManager; import com._1c.g5.v8.dt.rights.model.util.RightName; +import com.e1c.v8codestyle.internal.right.InternalRightInfosService; import com.e1c.v8codestyle.check.StandardCheckExtension; import com.e1c.v8codestyle.internal.right.CorePlugin; import com.google.inject.Inject; @@ -26,7 +30,7 @@ import com.google.inject.Inject; * @author Dmitriy Marmyshev * */ -public class RightInteracitveDeletePredefinedData +public class RightInteractiveDeletePredefinedData extends RoleRightSetCheck { @@ -36,9 +40,12 @@ public class RightInteracitveDeletePredefinedData * {@inheritDoc} */ @Inject - public RightInteracitveDeletePredefinedData(IV8ProjectManager v8ProjectManager, IBmModelManager bmModelManager) + public RightInteractiveDeletePredefinedData(IResourceLookup resourceLookup, IV8ProjectManager v8ProjectManager, + IBmModelManager bmModelManager, IBmRightsIndexManager bmRightsIndexManager, + IBmEmfIndexManager bmEmfIndexManager, InternalRightInfosService rightInfosService) { - super(v8ProjectManager, bmModelManager); + super(resourceLookup, v8ProjectManager, bmModelManager, bmRightsIndexManager, bmEmfIndexManager, + rightInfosService); } @Override diff --git a/bundles/com.e1c.v8codestyle.right/src/com/e1c/v8codestyle/right/check/RightInteractiveOpenExternalDataProcessors.java b/bundles/com.e1c.v8codestyle.right/src/com/e1c/v8codestyle/right/check/RightInteractiveOpenExternalDataProcessors.java index 4e37412f..f9f63975 100644 --- a/bundles/com.e1c.v8codestyle.right/src/com/e1c/v8codestyle/right/check/RightInteractiveOpenExternalDataProcessors.java +++ b/bundles/com.e1c.v8codestyle.right/src/com/e1c/v8codestyle/right/check/RightInteractiveOpenExternalDataProcessors.java @@ -14,11 +14,15 @@ package com.e1c.v8codestyle.right.check; import java.util.List; +import com._1c.g5.v8.dt.bm.index.emf.IBmEmfIndexManager; +import com._1c.g5.v8.dt.bm.index.rights.IBmRightsIndexManager; import com._1c.g5.v8.dt.core.platform.IBmModelManager; +import com._1c.g5.v8.dt.core.platform.IResourceLookup; import com._1c.g5.v8.dt.core.platform.IV8ProjectManager; import com._1c.g5.v8.dt.rights.model.util.RightName; import com.e1c.v8codestyle.check.StandardCheckExtension; import com.e1c.v8codestyle.internal.right.CorePlugin; +import com.e1c.v8codestyle.internal.right.InternalRightInfosService; import com.google.inject.Inject; /** @@ -40,10 +44,12 @@ public class RightInteractiveOpenExternalDataProcessors * {@inheritDoc} */ @Inject - public RightInteractiveOpenExternalDataProcessors(IV8ProjectManager v8ProjectManager, - IBmModelManager bmModelManager) + public RightInteractiveOpenExternalDataProcessors(IResourceLookup resourceLookup, + IV8ProjectManager v8ProjectManager, IBmModelManager bmModelManager, IBmRightsIndexManager bmRightsIndexManager, + IBmEmfIndexManager bmEmfIndexManager, InternalRightInfosService rightInfosService) { - super(v8ProjectManager, bmModelManager); + super(resourceLookup, v8ProjectManager, bmModelManager, bmRightsIndexManager, bmEmfIndexManager, + rightInfosService); } @Override @@ -56,7 +62,7 @@ public class RightInteractiveOpenExternalDataProcessors protected void configureCheck(CheckConfigurer builder) { super.configureCheck(builder); - builder.extension(new ExcludeRoleByNameListExtension(NAMES_DEFAULT, bmModelManager)) + builder.extension(new ExcludeRoleByNameListExtension(NAMES_DEFAULT, getBmModelManager())) .extension(new StandardCheckExtension(getCheckId(), CorePlugin.PLUGIN_ID)) .title(Messages.RightInteractiveOpenExternalDataProcessors_title) .description(Messages.RightInteractiveOpenExternalDataProcessors_description); diff --git a/bundles/com.e1c.v8codestyle.right/src/com/e1c/v8codestyle/right/check/RightInteractiveOpenExternalReports.java b/bundles/com.e1c.v8codestyle.right/src/com/e1c/v8codestyle/right/check/RightInteractiveOpenExternalReports.java index 814fdaaf..0ff8b3b8 100644 --- a/bundles/com.e1c.v8codestyle.right/src/com/e1c/v8codestyle/right/check/RightInteractiveOpenExternalReports.java +++ b/bundles/com.e1c.v8codestyle.right/src/com/e1c/v8codestyle/right/check/RightInteractiveOpenExternalReports.java @@ -14,11 +14,15 @@ package com.e1c.v8codestyle.right.check; import java.util.List; +import com._1c.g5.v8.dt.bm.index.emf.IBmEmfIndexManager; +import com._1c.g5.v8.dt.bm.index.rights.IBmRightsIndexManager; import com._1c.g5.v8.dt.core.platform.IBmModelManager; +import com._1c.g5.v8.dt.core.platform.IResourceLookup; import com._1c.g5.v8.dt.core.platform.IV8ProjectManager; import com._1c.g5.v8.dt.rights.model.util.RightName; import com.e1c.v8codestyle.check.StandardCheckExtension; import com.e1c.v8codestyle.internal.right.CorePlugin; +import com.e1c.v8codestyle.internal.right.InternalRightInfosService; import com.google.inject.Inject; /** @@ -40,9 +44,12 @@ public class RightInteractiveOpenExternalReports * {@inheritDoc} */ @Inject - public RightInteractiveOpenExternalReports(IV8ProjectManager v8ProjectManager, IBmModelManager bmModelManager) + public RightInteractiveOpenExternalReports(IResourceLookup resourceLookup, IV8ProjectManager v8ProjectManager, + IBmModelManager bmModelManager, IBmRightsIndexManager bmRightsIndexManager, + IBmEmfIndexManager bmEmfIndexManager, InternalRightInfosService rightInfosService) { - super(v8ProjectManager, bmModelManager); + super(resourceLookup, v8ProjectManager, bmModelManager, bmRightsIndexManager, bmEmfIndexManager, + rightInfosService); } @Override @@ -55,7 +62,7 @@ public class RightInteractiveOpenExternalReports protected void configureCheck(CheckConfigurer builder) { super.configureCheck(builder); - builder.extension(new ExcludeRoleByNameListExtension(NAMES_DEFAULT, bmModelManager)) + builder.extension(new ExcludeRoleByNameListExtension(NAMES_DEFAULT, getBmModelManager())) .extension(new StandardCheckExtension(getCheckId(), CorePlugin.PLUGIN_ID)) .title(Messages.RightInteractiveOpenExternalReports_title) .description(Messages.RightInteractiveOpenExternalReports_description); diff --git a/bundles/com.e1c.v8codestyle.right/src/com/e1c/v8codestyle/right/check/RightInteractiveSetDeletionMarkPredefinedData.java b/bundles/com.e1c.v8codestyle.right/src/com/e1c/v8codestyle/right/check/RightInteractiveSetDeletionMarkPredefinedData.java index a4d2903b..1220cc3b 100644 --- a/bundles/com.e1c.v8codestyle.right/src/com/e1c/v8codestyle/right/check/RightInteractiveSetDeletionMarkPredefinedData.java +++ b/bundles/com.e1c.v8codestyle.right/src/com/e1c/v8codestyle/right/check/RightInteractiveSetDeletionMarkPredefinedData.java @@ -13,9 +13,13 @@ *******************************************************************************/ package com.e1c.v8codestyle.right.check; +import com._1c.g5.v8.dt.bm.index.emf.IBmEmfIndexManager; +import com._1c.g5.v8.dt.bm.index.rights.IBmRightsIndexManager; import com._1c.g5.v8.dt.core.platform.IBmModelManager; +import com._1c.g5.v8.dt.core.platform.IResourceLookup; import com._1c.g5.v8.dt.core.platform.IV8ProjectManager; import com._1c.g5.v8.dt.rights.model.util.RightName; +import com.e1c.v8codestyle.internal.right.InternalRightInfosService; import com.e1c.v8codestyle.check.StandardCheckExtension; import com.e1c.v8codestyle.internal.right.CorePlugin; import com.google.inject.Inject; @@ -36,10 +40,12 @@ public class RightInteractiveSetDeletionMarkPredefinedData * {@inheritDoc} */ @Inject - public RightInteractiveSetDeletionMarkPredefinedData(IV8ProjectManager v8ProjectManager, - IBmModelManager bmModelManager) + public RightInteractiveSetDeletionMarkPredefinedData(IResourceLookup resourceLookup, + IV8ProjectManager v8ProjectManager, IBmModelManager bmModelManager, IBmRightsIndexManager bmRightsIndexManager, + IBmEmfIndexManager bmEmfIndexManager, InternalRightInfosService rightInfosService) { - super(v8ProjectManager, bmModelManager); + super(resourceLookup, v8ProjectManager, bmModelManager, bmRightsIndexManager, bmEmfIndexManager, + rightInfosService); } @Override diff --git a/bundles/com.e1c.v8codestyle.right/src/com/e1c/v8codestyle/right/check/RightOutputToPrinterFileClipboard.java b/bundles/com.e1c.v8codestyle.right/src/com/e1c/v8codestyle/right/check/RightOutputToPrinterFileClipboard.java index 1e969c94..4b1d04ec 100644 --- a/bundles/com.e1c.v8codestyle.right/src/com/e1c/v8codestyle/right/check/RightOutputToPrinterFileClipboard.java +++ b/bundles/com.e1c.v8codestyle.right/src/com/e1c/v8codestyle/right/check/RightOutputToPrinterFileClipboard.java @@ -14,11 +14,15 @@ package com.e1c.v8codestyle.right.check; import java.util.List; +import com._1c.g5.v8.dt.bm.index.emf.IBmEmfIndexManager; +import com._1c.g5.v8.dt.bm.index.rights.IBmRightsIndexManager; import com._1c.g5.v8.dt.core.platform.IBmModelManager; +import com._1c.g5.v8.dt.core.platform.IResourceLookup; import com._1c.g5.v8.dt.core.platform.IV8ProjectManager; import com._1c.g5.v8.dt.rights.model.util.RightName; import com.e1c.v8codestyle.check.StandardCheckExtension; import com.e1c.v8codestyle.internal.right.CorePlugin; +import com.e1c.v8codestyle.internal.right.InternalRightInfosService; import com.google.inject.Inject; /** @@ -40,9 +44,12 @@ public class RightOutputToPrinterFileClipboard * {@inheritDoc} */ @Inject - public RightOutputToPrinterFileClipboard(IV8ProjectManager v8ProjectManager, IBmModelManager bmModelManager) + public RightOutputToPrinterFileClipboard(IResourceLookup resourceLookup, IV8ProjectManager v8ProjectManager, + IBmModelManager bmModelManager, IBmRightsIndexManager bmRightsIndexManager, + IBmEmfIndexManager bmEmfIndexManager, InternalRightInfosService rightInfosService) { - super(v8ProjectManager, bmModelManager); + super(resourceLookup, v8ProjectManager, bmModelManager, bmRightsIndexManager, bmEmfIndexManager, + rightInfosService); } @Override @@ -55,7 +62,7 @@ public class RightOutputToPrinterFileClipboard protected void configureCheck(CheckConfigurer builder) { super.configureCheck(builder); - builder.extension(new ExcludeRoleByNameListExtension(NAMES_DEFAULT, bmModelManager)) + builder.extension(new ExcludeRoleByNameListExtension(NAMES_DEFAULT, getBmModelManager())) .extension(new StandardCheckExtension(getCheckId(), CorePlugin.PLUGIN_ID)) .title(Messages.RightOutputToPrinterFileClipboard_title) .description(Messages.RightOutputToPrinterFileClipboard_description); diff --git a/bundles/com.e1c.v8codestyle.right/src/com/e1c/v8codestyle/right/check/RightSaveUserData.java b/bundles/com.e1c.v8codestyle.right/src/com/e1c/v8codestyle/right/check/RightSaveUserData.java index e5f567be..a2813fd5 100644 --- a/bundles/com.e1c.v8codestyle.right/src/com/e1c/v8codestyle/right/check/RightSaveUserData.java +++ b/bundles/com.e1c.v8codestyle.right/src/com/e1c/v8codestyle/right/check/RightSaveUserData.java @@ -14,11 +14,15 @@ package com.e1c.v8codestyle.right.check; import java.util.List; +import com._1c.g5.v8.dt.bm.index.emf.IBmEmfIndexManager; +import com._1c.g5.v8.dt.bm.index.rights.IBmRightsIndexManager; import com._1c.g5.v8.dt.core.platform.IBmModelManager; +import com._1c.g5.v8.dt.core.platform.IResourceLookup; import com._1c.g5.v8.dt.core.platform.IV8ProjectManager; import com._1c.g5.v8.dt.rights.model.util.RightName; import com.e1c.v8codestyle.check.StandardCheckExtension; import com.e1c.v8codestyle.internal.right.CorePlugin; +import com.e1c.v8codestyle.internal.right.InternalRightInfosService; import com.google.inject.Inject; /** @@ -40,9 +44,12 @@ public class RightSaveUserData * {@inheritDoc} */ @Inject - public RightSaveUserData(IV8ProjectManager v8ProjectManager, IBmModelManager bmModelManager) + public RightSaveUserData(IResourceLookup resourceLookup, IV8ProjectManager v8ProjectManager, + IBmModelManager bmModelManager, IBmRightsIndexManager bmRightsIndexManager, + IBmEmfIndexManager bmEmfIndexManager, InternalRightInfosService rightInfosService) { - super(v8ProjectManager, bmModelManager); + super(resourceLookup, v8ProjectManager, bmModelManager, bmRightsIndexManager, bmEmfIndexManager, + rightInfosService); } @Override @@ -55,7 +62,7 @@ public class RightSaveUserData protected void configureCheck(CheckConfigurer builder) { super.configureCheck(builder); - builder.extension(new ExcludeRoleByNameListExtension(NAMES_DEFAULT, bmModelManager)) + builder.extension(new ExcludeRoleByNameListExtension(NAMES_DEFAULT, getBmModelManager())) .extension(new StandardCheckExtension(getCheckId(), CorePlugin.PLUGIN_ID)) .title(Messages.RightSaveUserData_title) .description(Messages.RightSaveUserData_description); diff --git a/bundles/com.e1c.v8codestyle.right/src/com/e1c/v8codestyle/right/check/RightStartAutomation.java b/bundles/com.e1c.v8codestyle.right/src/com/e1c/v8codestyle/right/check/RightStartAutomation.java index cfb3c5f9..7bdaad91 100644 --- a/bundles/com.e1c.v8codestyle.right/src/com/e1c/v8codestyle/right/check/RightStartAutomation.java +++ b/bundles/com.e1c.v8codestyle.right/src/com/e1c/v8codestyle/right/check/RightStartAutomation.java @@ -14,11 +14,15 @@ package com.e1c.v8codestyle.right.check; import java.util.List; +import com._1c.g5.v8.dt.bm.index.emf.IBmEmfIndexManager; +import com._1c.g5.v8.dt.bm.index.rights.IBmRightsIndexManager; import com._1c.g5.v8.dt.core.platform.IBmModelManager; +import com._1c.g5.v8.dt.core.platform.IResourceLookup; import com._1c.g5.v8.dt.core.platform.IV8ProjectManager; import com._1c.g5.v8.dt.rights.model.util.RightName; import com.e1c.v8codestyle.check.StandardCheckExtension; import com.e1c.v8codestyle.internal.right.CorePlugin; +import com.e1c.v8codestyle.internal.right.InternalRightInfosService; import com.google.inject.Inject; /** @@ -40,9 +44,12 @@ public class RightStartAutomation * {@inheritDoc} */ @Inject - public RightStartAutomation(IV8ProjectManager v8ProjectManager, IBmModelManager bmModelManager) + public RightStartAutomation(IResourceLookup resourceLookup, IV8ProjectManager v8ProjectManager, + IBmModelManager bmModelManager, IBmRightsIndexManager bmRightsIndexManager, + IBmEmfIndexManager bmEmfIndexManager, InternalRightInfosService rightInfosService) { - super(v8ProjectManager, bmModelManager); + super(resourceLookup, v8ProjectManager, bmModelManager, bmRightsIndexManager, bmEmfIndexManager, + rightInfosService); } @Override @@ -55,7 +62,7 @@ public class RightStartAutomation protected void configureCheck(CheckConfigurer builder) { super.configureCheck(builder); - builder.extension(new ExcludeRoleByNameListExtension(NAMES_DEFAULT, bmModelManager)) + builder.extension(new ExcludeRoleByNameListExtension(NAMES_DEFAULT, getBmModelManager())) .extension(new StandardCheckExtension(getCheckId(), CorePlugin.PLUGIN_ID)) .title(Messages.RightStartAutomation_title) .description(Messages.RightStartAutomation_description); diff --git a/bundles/com.e1c.v8codestyle.right/src/com/e1c/v8codestyle/right/check/RightStartExternalConnection.java b/bundles/com.e1c.v8codestyle.right/src/com/e1c/v8codestyle/right/check/RightStartExternalConnection.java index b9b30c97..86ce51d4 100644 --- a/bundles/com.e1c.v8codestyle.right/src/com/e1c/v8codestyle/right/check/RightStartExternalConnection.java +++ b/bundles/com.e1c.v8codestyle.right/src/com/e1c/v8codestyle/right/check/RightStartExternalConnection.java @@ -14,11 +14,15 @@ package com.e1c.v8codestyle.right.check; import java.util.List; +import com._1c.g5.v8.dt.bm.index.emf.IBmEmfIndexManager; +import com._1c.g5.v8.dt.bm.index.rights.IBmRightsIndexManager; import com._1c.g5.v8.dt.core.platform.IBmModelManager; +import com._1c.g5.v8.dt.core.platform.IResourceLookup; import com._1c.g5.v8.dt.core.platform.IV8ProjectManager; import com._1c.g5.v8.dt.rights.model.util.RightName; import com.e1c.v8codestyle.check.StandardCheckExtension; import com.e1c.v8codestyle.internal.right.CorePlugin; +import com.e1c.v8codestyle.internal.right.InternalRightInfosService; import com.google.inject.Inject; /** @@ -40,9 +44,12 @@ public class RightStartExternalConnection * {@inheritDoc} */ @Inject - public RightStartExternalConnection(IV8ProjectManager v8ProjectManager, IBmModelManager bmModelManager) + public RightStartExternalConnection(IResourceLookup resourceLookup, IV8ProjectManager v8ProjectManager, + IBmModelManager bmModelManager, IBmRightsIndexManager bmRightsIndexManager, + IBmEmfIndexManager bmEmfIndexManager, InternalRightInfosService rightInfosService) { - super(v8ProjectManager, bmModelManager); + super(resourceLookup, v8ProjectManager, bmModelManager, bmRightsIndexManager, bmEmfIndexManager, + rightInfosService); } @Override @@ -55,7 +62,7 @@ public class RightStartExternalConnection protected void configureCheck(CheckConfigurer builder) { super.configureCheck(builder); - builder.extension(new ExcludeRoleByNameListExtension(NAMES_DEFAULT, bmModelManager)) + builder.extension(new ExcludeRoleByNameListExtension(NAMES_DEFAULT, getBmModelManager())) .extension(new StandardCheckExtension(getCheckId(), CorePlugin.PLUGIN_ID)) .title(Messages.RightStartExternalConnection_title) .description(Messages.RightStartExternalConnection_description); diff --git a/bundles/com.e1c.v8codestyle.right/src/com/e1c/v8codestyle/right/check/RightStartThickClient.java b/bundles/com.e1c.v8codestyle.right/src/com/e1c/v8codestyle/right/check/RightStartThickClient.java index 3d1054d8..732bcf5c 100644 --- a/bundles/com.e1c.v8codestyle.right/src/com/e1c/v8codestyle/right/check/RightStartThickClient.java +++ b/bundles/com.e1c.v8codestyle.right/src/com/e1c/v8codestyle/right/check/RightStartThickClient.java @@ -14,11 +14,15 @@ package com.e1c.v8codestyle.right.check; import java.util.List; +import com._1c.g5.v8.dt.bm.index.emf.IBmEmfIndexManager; +import com._1c.g5.v8.dt.bm.index.rights.IBmRightsIndexManager; import com._1c.g5.v8.dt.core.platform.IBmModelManager; +import com._1c.g5.v8.dt.core.platform.IResourceLookup; import com._1c.g5.v8.dt.core.platform.IV8ProjectManager; import com._1c.g5.v8.dt.rights.model.util.RightName; import com.e1c.v8codestyle.check.StandardCheckExtension; import com.e1c.v8codestyle.internal.right.CorePlugin; +import com.e1c.v8codestyle.internal.right.InternalRightInfosService; import com.google.inject.Inject; /** @@ -40,9 +44,12 @@ public class RightStartThickClient * {@inheritDoc} */ @Inject - public RightStartThickClient(IV8ProjectManager v8ProjectManager, IBmModelManager bmModelManager) + public RightStartThickClient(IResourceLookup resourceLookup, IV8ProjectManager v8ProjectManager, + IBmModelManager bmModelManager, IBmRightsIndexManager bmRightsIndexManager, + IBmEmfIndexManager bmEmfIndexManager, InternalRightInfosService rightInfosService) { - super(v8ProjectManager, bmModelManager); + super(resourceLookup, v8ProjectManager, bmModelManager, bmRightsIndexManager, bmEmfIndexManager, + rightInfosService); } @Override @@ -55,7 +62,7 @@ public class RightStartThickClient protected void configureCheck(CheckConfigurer builder) { super.configureCheck(builder); - builder.extension(new ExcludeRoleByNameListExtension(NAMES_DEFAULT, bmModelManager)) + builder.extension(new ExcludeRoleByNameListExtension(NAMES_DEFAULT, getBmModelManager())) .extension(new StandardCheckExtension(getCheckId(), CorePlugin.PLUGIN_ID)) .title(Messages.RightStartThickClient_title) .description(Messages.RightStartThickClient_description); diff --git a/bundles/com.e1c.v8codestyle.right/src/com/e1c/v8codestyle/right/check/RightStartThinClient.java b/bundles/com.e1c.v8codestyle.right/src/com/e1c/v8codestyle/right/check/RightStartThinClient.java index ddc9825d..d22375ca 100644 --- a/bundles/com.e1c.v8codestyle.right/src/com/e1c/v8codestyle/right/check/RightStartThinClient.java +++ b/bundles/com.e1c.v8codestyle.right/src/com/e1c/v8codestyle/right/check/RightStartThinClient.java @@ -14,11 +14,15 @@ package com.e1c.v8codestyle.right.check; import java.util.List; +import com._1c.g5.v8.dt.bm.index.emf.IBmEmfIndexManager; +import com._1c.g5.v8.dt.bm.index.rights.IBmRightsIndexManager; import com._1c.g5.v8.dt.core.platform.IBmModelManager; +import com._1c.g5.v8.dt.core.platform.IResourceLookup; import com._1c.g5.v8.dt.core.platform.IV8ProjectManager; import com._1c.g5.v8.dt.rights.model.util.RightName; import com.e1c.v8codestyle.check.StandardCheckExtension; import com.e1c.v8codestyle.internal.right.CorePlugin; +import com.e1c.v8codestyle.internal.right.InternalRightInfosService; import com.google.inject.Inject; /** @@ -40,9 +44,12 @@ public class RightStartThinClient * {@inheritDoc} */ @Inject - public RightStartThinClient(IV8ProjectManager v8ProjectManager, IBmModelManager bmModelManager) + public RightStartThinClient(IResourceLookup resourceLookup, IV8ProjectManager v8ProjectManager, + IBmModelManager bmModelManager, IBmRightsIndexManager bmRightsIndexManager, + IBmEmfIndexManager bmEmfIndexManager, InternalRightInfosService rightInfosService) { - super(v8ProjectManager, bmModelManager); + super(resourceLookup, v8ProjectManager, bmModelManager, bmRightsIndexManager, bmEmfIndexManager, + rightInfosService); } @Override @@ -55,7 +62,7 @@ public class RightStartThinClient protected void configureCheck(CheckConfigurer builder) { super.configureCheck(builder); - builder.extension(new ExcludeRoleByNameListExtension(NAMES_DEFAULT, bmModelManager)) + builder.extension(new ExcludeRoleByNameListExtension(NAMES_DEFAULT, getBmModelManager())) .extension(new StandardCheckExtension(getCheckId(), CorePlugin.PLUGIN_ID)) .title(Messages.RightStartThinClient_title) .description(Messages.RightStartThinClient_description); diff --git a/bundles/com.e1c.v8codestyle.right/src/com/e1c/v8codestyle/right/check/RightStartWebClient.java b/bundles/com.e1c.v8codestyle.right/src/com/e1c/v8codestyle/right/check/RightStartWebClient.java index 567daa2e..29295377 100644 --- a/bundles/com.e1c.v8codestyle.right/src/com/e1c/v8codestyle/right/check/RightStartWebClient.java +++ b/bundles/com.e1c.v8codestyle.right/src/com/e1c/v8codestyle/right/check/RightStartWebClient.java @@ -14,11 +14,15 @@ package com.e1c.v8codestyle.right.check; import java.util.List; +import com._1c.g5.v8.dt.bm.index.emf.IBmEmfIndexManager; +import com._1c.g5.v8.dt.bm.index.rights.IBmRightsIndexManager; import com._1c.g5.v8.dt.core.platform.IBmModelManager; +import com._1c.g5.v8.dt.core.platform.IResourceLookup; import com._1c.g5.v8.dt.core.platform.IV8ProjectManager; import com._1c.g5.v8.dt.rights.model.util.RightName; import com.e1c.v8codestyle.check.StandardCheckExtension; import com.e1c.v8codestyle.internal.right.CorePlugin; +import com.e1c.v8codestyle.internal.right.InternalRightInfosService; import com.google.inject.Inject; /** @@ -40,9 +44,12 @@ public class RightStartWebClient * {@inheritDoc} */ @Inject - public RightStartWebClient(IV8ProjectManager v8ProjectManager, IBmModelManager bmModelManager) + public RightStartWebClient(IResourceLookup resourceLookup, IV8ProjectManager v8ProjectManager, + IBmModelManager bmModelManager, IBmRightsIndexManager bmRightsIndexManager, + IBmEmfIndexManager bmEmfIndexManager, InternalRightInfosService rightInfosService) { - super(v8ProjectManager, bmModelManager); + super(resourceLookup, v8ProjectManager, bmModelManager, bmRightsIndexManager, bmEmfIndexManager, + rightInfosService); } @Override @@ -55,7 +62,7 @@ public class RightStartWebClient protected void configureCheck(CheckConfigurer builder) { super.configureCheck(builder); - builder.extension(new ExcludeRoleByNameListExtension(NAMES_DEFAULT, bmModelManager)) + builder.extension(new ExcludeRoleByNameListExtension(NAMES_DEFAULT, getBmModelManager())) .extension(new StandardCheckExtension(getCheckId(), CorePlugin.PLUGIN_ID)) .title(Messages.RightStartWebClient_title) .description(Messages.RightStartWebClient_description); diff --git a/bundles/com.e1c.v8codestyle.right/src/com/e1c/v8codestyle/right/check/RightUpdateDatabaseConfiguration.java b/bundles/com.e1c.v8codestyle.right/src/com/e1c/v8codestyle/right/check/RightUpdateDatabaseConfiguration.java index 40bc40d2..7a616ab1 100644 --- a/bundles/com.e1c.v8codestyle.right/src/com/e1c/v8codestyle/right/check/RightUpdateDatabaseConfiguration.java +++ b/bundles/com.e1c.v8codestyle.right/src/com/e1c/v8codestyle/right/check/RightUpdateDatabaseConfiguration.java @@ -14,11 +14,15 @@ package com.e1c.v8codestyle.right.check; import java.util.List; +import com._1c.g5.v8.dt.bm.index.emf.IBmEmfIndexManager; +import com._1c.g5.v8.dt.bm.index.rights.IBmRightsIndexManager; import com._1c.g5.v8.dt.core.platform.IBmModelManager; +import com._1c.g5.v8.dt.core.platform.IResourceLookup; import com._1c.g5.v8.dt.core.platform.IV8ProjectManager; import com._1c.g5.v8.dt.rights.model.util.RightName; import com.e1c.v8codestyle.check.StandardCheckExtension; import com.e1c.v8codestyle.internal.right.CorePlugin; +import com.e1c.v8codestyle.internal.right.InternalRightInfosService; import com.google.inject.Inject; /** @@ -40,9 +44,12 @@ public class RightUpdateDatabaseConfiguration * {@inheritDoc} */ @Inject - public RightUpdateDatabaseConfiguration(IV8ProjectManager v8ProjectManager, IBmModelManager bmModelManager) + public RightUpdateDatabaseConfiguration(IResourceLookup resourceLookup, IV8ProjectManager v8ProjectManager, + IBmModelManager bmModelManager, IBmRightsIndexManager bmRightsIndexManager, + IBmEmfIndexManager bmEmfIndexManager, InternalRightInfosService rightInfosService) { - super(v8ProjectManager, bmModelManager); + super(resourceLookup, v8ProjectManager, bmModelManager, bmRightsIndexManager, bmEmfIndexManager, + rightInfosService); } @Override @@ -55,7 +62,7 @@ public class RightUpdateDatabaseConfiguration protected void configureCheck(CheckConfigurer builder) { super.configureCheck(builder); - builder.extension(new ExcludeRoleByNameListExtension(NAMES_DEFAULT, bmModelManager)) + builder.extension(new ExcludeRoleByNameListExtension(NAMES_DEFAULT, getBmModelManager())) .extension(new StandardCheckExtension(getCheckId(), CorePlugin.PLUGIN_ID)) .title(Messages.RightUpdateDatabaseConfiguration_title) .description(Messages.RightUpdateDatabaseConfiguration_description); diff --git a/bundles/com.e1c.v8codestyle.right/src/com/e1c/v8codestyle/right/check/RightViewEventLog.java b/bundles/com.e1c.v8codestyle.right/src/com/e1c/v8codestyle/right/check/RightViewEventLog.java index 337dd54d..dc864bd2 100644 --- a/bundles/com.e1c.v8codestyle.right/src/com/e1c/v8codestyle/right/check/RightViewEventLog.java +++ b/bundles/com.e1c.v8codestyle.right/src/com/e1c/v8codestyle/right/check/RightViewEventLog.java @@ -14,11 +14,15 @@ package com.e1c.v8codestyle.right.check; import java.util.List; +import com._1c.g5.v8.dt.bm.index.emf.IBmEmfIndexManager; +import com._1c.g5.v8.dt.bm.index.rights.IBmRightsIndexManager; import com._1c.g5.v8.dt.core.platform.IBmModelManager; +import com._1c.g5.v8.dt.core.platform.IResourceLookup; import com._1c.g5.v8.dt.core.platform.IV8ProjectManager; import com._1c.g5.v8.dt.rights.model.util.RightName; import com.e1c.v8codestyle.check.StandardCheckExtension; import com.e1c.v8codestyle.internal.right.CorePlugin; +import com.e1c.v8codestyle.internal.right.InternalRightInfosService; import com.google.inject.Inject; /** @@ -43,9 +47,13 @@ public class RightViewEventLog * @param bmModelManager the BM model manager, cannot be {@code null}. */ @Inject - public RightViewEventLog(IV8ProjectManager v8ProjectManager, IBmModelManager bmModelManager) + public RightViewEventLog(IResourceLookup resourceLookup, IV8ProjectManager v8ProjectManager, + IBmModelManager bmModelManager, IBmRightsIndexManager bmRightsIndexManager, + IBmEmfIndexManager bmEmfIndexManager, InternalRightInfosService rightInfosService, + IBmModelManager bmModelManager2) { - super(v8ProjectManager, bmModelManager); + super(resourceLookup, v8ProjectManager, bmModelManager, bmRightsIndexManager, bmEmfIndexManager, + rightInfosService); } @Override @@ -58,7 +66,7 @@ public class RightViewEventLog protected void configureCheck(CheckConfigurer builder) { super.configureCheck(builder); - builder.extension(new ExcludeRoleByNameListExtension(NAMES_DEFAULT, bmModelManager)) + builder.extension(new ExcludeRoleByNameListExtension(NAMES_DEFAULT, getBmModelManager())) .extension(new StandardCheckExtension(getCheckId(), CorePlugin.PLUGIN_ID)) .title(Messages.RightViewEventLog_title) .description(Messages.RightViewEventLog_description); diff --git a/bundles/com.e1c.v8codestyle.right/src/com/e1c/v8codestyle/right/check/RoleRightSetCheck.java b/bundles/com.e1c.v8codestyle.right/src/com/e1c/v8codestyle/right/check/RoleRightSetCheck.java index 04cc52e4..d5eccf16 100644 --- a/bundles/com.e1c.v8codestyle.right/src/com/e1c/v8codestyle/right/check/RoleRightSetCheck.java +++ b/bundles/com.e1c.v8codestyle.right/src/com/e1c/v8codestyle/right/check/RoleRightSetCheck.java @@ -13,21 +13,50 @@ *******************************************************************************/ package com.e1c.v8codestyle.right.check; +import static com._1c.g5.v8.dt.metadata.mdclass.MdClassPackage.Literals.MD_OBJECT; import static com._1c.g5.v8.dt.rights.model.RightsPackage.Literals.OBJECT_RIGHT; +import static com._1c.g5.v8.dt.rights.model.RightsPackage.Literals.OBJECT_RIGHTS; +import static com._1c.g5.v8.dt.rights.model.RightsPackage.Literals.OBJECT_RIGHTS__OBJECT; import static com._1c.g5.v8.dt.rights.model.RightsPackage.Literals.OBJECT_RIGHT__RIGHT; import static com._1c.g5.v8.dt.rights.model.RightsPackage.Literals.OBJECT_RIGHT__VALUE; import static com._1c.g5.v8.dt.rights.model.RightsPackage.Literals.ROLE_DESCRIPTION; +import static com._1c.g5.v8.dt.rights.model.RightsPackage.Literals.ROLE_DESCRIPTION__RIGHTS; +import static com._1c.g5.v8.dt.rights.model.RightsPackage.Literals.ROLE_DESCRIPTION__SET_FOR_NEW_OBJECTS; import java.text.MessageFormat; +import java.util.Collection; +import java.util.Collections; +import java.util.HashSet; +import java.util.Iterator; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.stream.Collectors; +import org.eclipse.core.resources.IProject; import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.emf.common.util.URI; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EObject; import org.eclipse.xtext.EcoreUtil2; +import org.eclipse.xtext.resource.IEObjectDescription; +import com._1c.g5.v8.bm.core.BmUriUtil; +import com._1c.g5.v8.bm.core.IBmObject; +import com._1c.g5.v8.bm.core.IBmTransaction; import com._1c.g5.v8.bm.integration.IBmModel; +import com._1c.g5.v8.dt.bm.index.emf.IBmEmfIndexManager; +import com._1c.g5.v8.dt.bm.index.emf.IBmEmfIndexProvider; +import com._1c.g5.v8.dt.bm.index.rights.IBmRightsIndexManager; +import com._1c.g5.v8.dt.bm.index.rights.IBmRightsIndexProvider; +import com._1c.g5.v8.dt.bm.index.rights.IRightsDescription; import com._1c.g5.v8.dt.common.StringUtils; import com._1c.g5.v8.dt.core.platform.IBmModelManager; +import com._1c.g5.v8.dt.core.platform.IResourceLookup; import com._1c.g5.v8.dt.core.platform.IV8Project; import com._1c.g5.v8.dt.core.platform.IV8ProjectManager; +import com._1c.g5.v8.dt.mcore.NamedElement; import com._1c.g5.v8.dt.md.MdUtil; import com._1c.g5.v8.dt.metadata.mdclass.MdObject; import com._1c.g5.v8.dt.metadata.mdclass.Role; @@ -40,16 +69,33 @@ import com._1c.g5.v8.dt.rights.model.RoleDescription; import com._1c.g5.v8.dt.rights.model.util.RightName; import com._1c.g5.v8.dt.rights.model.util.RightsModelUtil; import com.e1c.g5.v8.dt.check.CheckComplexity; +import com.e1c.g5.v8.dt.check.ICheckDefinition; import com.e1c.g5.v8.dt.check.ICheckParameters; import com.e1c.g5.v8.dt.check.components.BasicCheck; +import com.e1c.g5.v8.dt.check.components.IBasicCheckExtension; +import com.e1c.g5.v8.dt.check.context.CheckContextCollectingSession; +import com.e1c.g5.v8.dt.check.context.OnModelObjectAssociationContextCollector; +import com.e1c.g5.v8.dt.check.context.OnModelObjectRemovalContextCollector; import com.e1c.g5.v8.dt.check.settings.IssueSeverity; import com.e1c.g5.v8.dt.check.settings.IssueType; import com.e1c.v8codestyle.check.StandardCheckExtension; import com.e1c.v8codestyle.internal.right.CorePlugin; -import com.google.inject.Inject; +import com.e1c.v8codestyle.internal.right.InternalRightInfosService; /** * Abstract check that role has some right for any object. + * This check register for two different types of object. + *
  • + * Registers for {@link RoleDescription} and check it only it has flag {@link RoleDescription#isSetForNewObjects()} + * which means data model contains only non-default rights for an object. + *
  • + * Also it registers for {@link ObjectRight} that contain specific right for certain object. + *
+ *
+ * The check reacts on changes in intermediate object {@link ObjectRights} to reschedule check for top-object. + *
+ * Implementors should call {@code super.configureCheck(builder);} when overriding + * method {@link #configureCheck(CheckConfigurer)} * * @author Dmitriy Marmyshev * @@ -60,37 +106,54 @@ public abstract class RoleRightSetCheck protected static final String EXCLUDE_OBJECT_NAME_PATTERN_PARAMETER_NAME = "excludeObjectNamePattern"; //$NON-NLS-1$ + private final IResourceLookup resourceLookup; + private final IV8ProjectManager v8ProjectManager; - protected final IBmModelManager bmModelManager; + private final IBmModelManager bmModelManager; + + private final IBmRightsIndexManager bmRightsIndexManager; + + private final IBmEmfIndexManager bmEmfIndexManager; + + private final InternalRightInfosService rightInfosService; /** * Creates new instance which helps to check that role has specified right for an object. * * @param v8ProjectManager the V8 project manager, cannot be {@code null}. * @param bmModelManager the BM model manager, cannot be {@code null}. + * @param bmRightsIndexProvider the BM rights index provider, cannot be {@code null}. + * @param bmEmfIndexProvider the BM EMF index provider, cannot be {@code null}. + * @param rightInfosService the right info service, cannot be {@code null}. */ - @Inject - protected RoleRightSetCheck(IV8ProjectManager v8ProjectManager, IBmModelManager bmModelManager) + protected RoleRightSetCheck(IResourceLookup resourceLookup, IV8ProjectManager v8ProjectManager, + IBmModelManager bmModelManager, IBmRightsIndexManager bmRightsIndexManager, + IBmEmfIndexManager bmEmfIndexManager, InternalRightInfosService rightInfosService) { + this.resourceLookup = resourceLookup; this.v8ProjectManager = v8ProjectManager; this.bmModelManager = bmModelManager; + this.bmRightsIndexManager = bmRightsIndexManager; + this.bmEmfIndexManager = bmEmfIndexManager; + this.rightInfosService = rightInfosService; } @Override protected void configureCheck(CheckConfigurer builder) { - //@formatter:off builder.complexity(CheckComplexity.NORMAL) .severity(IssueSeverity.MAJOR) .issueType(IssueType.SECURITY) + .extension(new CombinedChangeExtension()) .extension(new ExcludeRoleByPatternExtension(bmModelManager)) .extension(new RoleNameChangeExtension()) .extension(new StandardCheckExtension(getCheckId(), CorePlugin.PLUGIN_ID)) .topObject(ROLE_DESCRIPTION) + .checkTop() + .features(ROLE_DESCRIPTION__SET_FOR_NEW_OBJECTS, ROLE_DESCRIPTION__RIGHTS) .containment(OBJECT_RIGHT) .features(OBJECT_RIGHT__RIGHT, OBJECT_RIGHT__VALUE); - //@formatter:on if (needCheckObjectRight()) { @@ -103,47 +166,24 @@ public abstract class RoleRightSetCheck protected void check(Object object, ResultAcceptor resultAceptor, ICheckParameters parameters, IProgressMonitor monitor) { - ObjectRight objectRight = (ObjectRight)object; - Right right = objectRight.getRight(); - - if (right == null || !getRightName().getName().equals(right.getName())) + if (object instanceof RoleDescription) { - return; + check((RoleDescription)object, resultAceptor, parameters, monitor); } - - Role role = null; - - RightValue rightValue = objectRight.getValue(); - if (rightValue == null) + else if (object instanceof ObjectRight) { - role = getRole(objectRight); - rightValue = RightsModelUtil.getDefaultRightValue(objectRight, role); + check((ObjectRight)object, resultAceptor, parameters, monitor); } + } - if (!RightsModelUtil.getBooleanRightValue(rightValue) || monitor.isCanceled()) - { - return; - } - - ObjectRights rights = EcoreUtil2.getContainerOfType(objectRight, ObjectRights.class); - MdObject mdObject = rights.getObject() instanceof MdObject ? (MdObject)rights.getObject() : null; - if (mdObject == null) - { - return; - } - - if (needCheckObjectRight()) - { - String excludeObjectNamePattern = parameters.getString(EXCLUDE_OBJECT_NAME_PATTERN_PARAMETER_NAME); - if (excludeObjectNamePattern != null && !excludeObjectNamePattern.isBlank() - && mdObject.getName().matches(excludeObjectNamePattern)) - { - return; - } - } - - String message = getIssueMessage(right, mdObject); - resultAceptor.addIssue(message, OBJECT_RIGHT__RIGHT); + /** + * Gets the BM model manager service. + * + * @return the BM model manager, cannot return {@code null}. + */ + protected IBmModelManager getBmModelManager() + { + return bmModelManager; } /** @@ -156,14 +196,13 @@ public abstract class RoleRightSetCheck /** * Creates formated issue message for the right and the MD object. * - * @param right the right that forbidden to set for the MD object, cannot be {@code null}. * @param mdObject the MD object that has forbidden right, cannot be {@code null}. * @return the formatted issue message that right set for the object, cannot return {@code null}. */ - protected String getIssueMessage(Right right, MdObject mdObject) + protected String getIssueMessage(MdObject mdObject) { IV8Project project = mdObject == null ? null : v8ProjectManager.getProject(mdObject); - String rightName = getRightName(right, project); + String rightName = getRightName(project); String mdObjectName = getMdObjectName(mdObject, project); return MessageFormat.format(Messages.RoleRightSetCheck_Role_right__0__set_for__1, rightName, mdObjectName); } @@ -178,6 +217,91 @@ public abstract class RoleRightSetCheck return true; } + private void check(RoleDescription object, ResultAcceptor resultAceptor, ICheckParameters parameters, + IProgressMonitor monitor) + { + if (!object.isSetForNewObjects()) + { + return; + } + + Collection mdObjects = getDefaultObjectsWithRight(object, monitor); + + List rights = object.getRights(); + for (MdObject mdObject : mdObjects) + { + if (monitor.isCanceled()) + { + return; + } + if (needCheckObjectRight()) + { + String excludeObjectNamePattern = parameters.getString(EXCLUDE_OBJECT_NAME_PATTERN_PARAMETER_NAME); + if (excludeObjectNamePattern != null && !excludeObjectNamePattern.isBlank() + && mdObject.getName().matches(excludeObjectNamePattern)) + { + continue; + } + } + String message = getIssueMessage(mdObject); + ObjectRights objectRights = RightsModelUtil.filterObjectRightsByEObject(mdObject, rights); + if (objectRights == null) + { + resultAceptor.addIssue(message, ROLE_DESCRIPTION__RIGHTS); + } + else + { + // add marker as closer as possible to the probleb place in the model + resultAceptor.addIssue(message, objectRights, OBJECT_RIGHTS__OBJECT); + } + } + } + + private void check(ObjectRight object, ResultAcceptor resultAceptor, ICheckParameters parameters, + IProgressMonitor monitor) + { + Right right = object.getRight(); + + if (right == null || !getRightName().getName().equals(right.getName())) + { + return; + } + + Role role = null; + + RightValue rightValue = object.getValue(); + if (rightValue == null) + { + role = getRole(object); + rightValue = RightsModelUtil.getDefaultRightValue(object, role); + } + + if (!RightsModelUtil.getBooleanRightValue(rightValue) || monitor.isCanceled()) + { + return; + } + + ObjectRights rights = EcoreUtil2.getContainerOfType(object, ObjectRights.class); + MdObject mdObject = rights.getObject() instanceof MdObject ? (MdObject)rights.getObject() : null; + if (mdObject == null || monitor.isCanceled()) + { + return; + } + + if (needCheckObjectRight()) + { + String excludeObjectNamePattern = parameters.getString(EXCLUDE_OBJECT_NAME_PATTERN_PARAMETER_NAME); + if (excludeObjectNamePattern != null && !excludeObjectNamePattern.isBlank() + && mdObject.getName().matches(excludeObjectNamePattern)) + { + return; + } + } + + String message = getIssueMessage(mdObject); + resultAceptor.addIssue(message, OBJECT_RIGHT__RIGHT); + } + private Role getRole(ObjectRight objectRight) { IBmModel model = bmModelManager.getModel(objectRight); @@ -185,8 +309,9 @@ public abstract class RoleRightSetCheck return RightsModelUtil.getOwner(description, model); } - private String getRightName(Right right, IV8Project project) + private String getRightName(IV8Project project) { + RightName right = getRightName(); if (project != null && project.getScriptVariant() == ScriptVariant.RUSSIAN) { return right.getNameRu(); @@ -210,4 +335,185 @@ public abstract class RoleRightSetCheck return MdUtil.getFullyQualifiedName(mdObject).toString(); } + private Collection getDefaultObjectsWithRight(RoleDescription description, IProgressMonitor monitor) + { + Collection result = new LinkedList<>(); + + IProject project = resourceLookup.getProject(description); + + Set objectIdForRole = getRoleTopObjects(project, description, monitor); + if (monitor.isCanceled()) + { + return Collections.emptyList(); + } + + IBmEmfIndexProvider bmEmfIndexProvider = bmEmfIndexManager.getEmfIndexProvider(project); + RightsModelUtil.SUPPORTED_RIGHT_ECLASSES.stream().forEach(eClass -> { + + // filter class that can't have needed right + if (!hasRight(eClass, description)) + { + return; + } + + for (Iterator iterator = + bmEmfIndexProvider.getEObjectIndexByType(eClass).iterator(); iterator.hasNext();) + { + if (monitor.isCanceled()) + { + return; + } + IEObjectDescription objectDescription = iterator.next(); + EObject object = objectDescription.getEObjectOrProxy(); + if (object instanceof IBmObject && object instanceof MdObject) + { + final long bmObjectId = ((IBmObject)object).bmGetId(); + + if (!objectIdForRole.contains(bmObjectId)) + { + result.add((MdObject)object); + } + } + } + }); + return result; + } + + private Set getRoleTopObjects(IProject project, RoleDescription description, IProgressMonitor monitor) + { + IBmModel model = bmModelManager.getModel(description); + + Role role = RightsModelUtil.getOwner(description, model); + + IBmRightsIndexProvider bmRightsIndexProvider = bmRightsIndexManager.getRightsIndexProvider(project); + IRightsDescription roleIndex = bmRightsIndexProvider.getRoleIndex(role); + + if (roleIndex == null) + { + return Collections.emptySet(); + } + + Set result = new HashSet<>(); + + Set topObjects = roleIndex.getTopObjectsWithNonDefaultRights(); + String rightName = getRightName().getName(); + + for (Long objectId : topObjects) + { + if (monitor.isCanceled()) + { + return Collections.emptySet(); + } + Map rights = roleIndex.getRights(objectId); + if (rights != null && rights.containsKey(rightName)) + { + result.add(objectId); + } + } + return result; + } + + private boolean hasRight(EClass eClass, EObject context) + { + Set rights = rightInfosService.getEClassRights(eClass, context); + Set rightNames = rights.stream().map(NamedElement::getName).collect(Collectors.toSet()); + return rightNames.contains(getRightName().getName()); + } + + /** + * This extension is combining all changes in containments of RoleDescription and schedule TOP object if needed. + * Also it reacts on adding or removing TOP MD-objects and schedule all role descriptions with SetForNewObjects. + */ + private final class CombinedChangeExtension + implements IBasicCheckExtension + { + @Override + public void configureContextCollector(ICheckDefinition definition) + { + // add reaction change of features "SET_FOR_NEW_OBJECTS" of existing object + definition.addModelFeatureChangeContextCollector((bmObject, feature, bmEvent, contextSession) -> { + if (feature == ROLE_DESCRIPTION__SET_FOR_NEW_OBJECTS) + { + // global flag changed - so fully re-check ROLE_DESCRIPTION for all checks + contextSession.addFullCheck(bmObject); + } + }, ROLE_DESCRIPTION); + + // if MD object changed then schedule full check for description or even for all checks + definition.addModelFeatureChangeContextCollector((bmObject, feature, bmEvent, contextSession) -> { + if (feature == OBJECT_RIGHTS__OBJECT) + { + IBmObject top = bmObject.bmGetTopObject(); + if (top instanceof RoleDescription && ((RoleDescription)top).isSetForNewObjects()) + { + contextSession.addModelCheck(top); + } + else if (top instanceof RoleDescription) + { + // schedule full check for top for all checks + contextSession.addFullCheck(top); + } + } + }, OBJECT_RIGHTS); + + // add reaction on creating new objects - that schedule role description + OnModelObjectAssociationContextCollector topCollector = (bmObject, bmEvent, contextSession) -> { + IBmObject top = bmObject.bmGetTopObject(); + if (top instanceof RoleDescription && ((RoleDescription)top).isSetForNewObjects()) + { + contextSession.addModelCheck(top); + } + }; + definition.addModelAssociationContextCollector(topCollector, OBJECT_RIGHTS); + definition.addModelAssociationContextCollector(topCollector, OBJECT_RIGHT); + + // For every new TOP MD object schedule all role descriptions with SetForNewObjects + definition.addModelAssociationContextCollector((bmObject, bmEvent, contextSession) -> { + if (bmObject.bmIsTop() && bmObject.bmGetTransaction() != null) + { + scheduleFullCheckForAllRoles(bmObject.eClass(), bmObject.bmGetTransaction(), contextSession); + } + }, MD_OBJECT); + + // if delete some objects then re-schedule full check for role description + OnModelObjectRemovalContextCollector containmentRemoval = + (removedObjectUri, removedObjectEClass, bmEvent, contextSession, transaction) -> { + URI topUri = removedObjectUri.trimFragment().appendFragment(BmUriUtil.TOP_OBJECT_PATH); + IBmObject top = transaction.getObjectByUri(topUri); + if (top instanceof RoleDescription && ((RoleDescription)top).isSetForNewObjects()) + { + contextSession.addModelCheck(top); + } + }; + definition.addModelRemovalContextCollector(containmentRemoval, OBJECT_RIGHTS); + definition.addModelRemovalContextCollector(containmentRemoval, OBJECT_RIGHT); + + // if TOP object removed then schedule all role descriptions with SetForNewObjects + definition.addModelRemovalContextCollector( + (removedObjectUri, removedObjectEClass, bmEvent, contextSession, transaction) -> { + if (BmUriUtil.TOP_OBJECT_PATH.equals(removedObjectUri.fragment())) + { + scheduleFullCheckForAllRoles(removedObjectEClass, transaction, contextSession); + } + }, MD_OBJECT); + } + + private void scheduleFullCheckForAllRoles(EClass eClass, IBmTransaction transaction, + CheckContextCollectingSession contextSession) + { + if (transaction != null && RightsModelUtil.SUPPORTED_RIGHT_ECLASSES.contains(eClass)) + { + for (Iterator iterator = transaction.getTopObjectIterator(ROLE_DESCRIPTION); iterator + .hasNext();) + { + IBmObject object = iterator.next(); + if (object instanceof RoleDescription && ((RoleDescription)object).isSetForNewObjects()) + { + contextSession.addFullCheck(object); + } + } + } + } + } + } diff --git a/tests/com.e1c.v8codestyle.right.itests/src/com/e1c/v8codestyle/right/check/itests/RoleRightHasForbiddenTest.java b/tests/com.e1c.v8codestyle.right.itests/src/com/e1c/v8codestyle/right/check/itests/RoleRightHasForbiddenTest.java index 9ea572ca..19e3285d 100644 --- a/tests/com.e1c.v8codestyle.right.itests/src/com/e1c/v8codestyle/right/check/itests/RoleRightHasForbiddenTest.java +++ b/tests/com.e1c.v8codestyle.right.itests/src/com/e1c/v8codestyle/right/check/itests/RoleRightHasForbiddenTest.java @@ -30,17 +30,17 @@ import com._1c.g5.v8.dt.rights.model.util.RightName; import com._1c.g5.v8.dt.validation.marker.Marker; import com.e1c.g5.v8.dt.check.settings.CheckUid; import com.e1c.g5.v8.dt.testing.check.CheckTestBase; -import com.e1c.v8codestyle.right.check.RightInteracitveDelete; -import com.e1c.v8codestyle.right.check.RightInteracitveDeleteMarkedPredefinedData; -import com.e1c.v8codestyle.right.check.RightInteracitveDeletePredefinedData; import com.e1c.v8codestyle.right.check.RightInteractiveClearDeletionMarkPredefinedData; +import com.e1c.v8codestyle.right.check.RightInteractiveDelete; +import com.e1c.v8codestyle.right.check.RightInteractiveDeleteMarkedPredefinedData; +import com.e1c.v8codestyle.right.check.RightInteractiveDeletePredefinedData; import com.e1c.v8codestyle.right.check.RightInteractiveSetDeletionMarkPredefinedData; /** * Tests for all forbidden rights checks: - * {@link RightInteracitveDelete}, - * {@link RightInteracitveDeleteMarkedPredefinedData}, - * {@link RightInteracitveDeletePredefinedData}, + * {@link RightInteractiveDelete}, + * {@link RightInteractiveDeleteMarkedPredefinedData}, + * {@link RightInteractiveDeletePredefinedData}, * {@link RightInteractiveClearDeletionMarkPredefinedData}, * {@link RightInteractiveSetDeletionMarkPredefinedData}. * @@ -64,6 +64,8 @@ public class RoleRightHasForbiddenTest private static final String FQN_FORBIDDEN_RIGHTS = "Role.ForbiddenRights.Rights"; + private static final String FQN_FORBIDDEN_RIGHTS2 = "Role.FullAccess.Rights"; + private static final String FQN_ALLOWED_RIGHTS = "Role.AllowedRights.Rights"; private IDtProject dtProject; @@ -93,12 +95,12 @@ public class RoleRightHasForbiddenTest } /** - * Test role has forbidden right, check {@link RightInteracitveDelete} + * Test role has forbidden right, check {@link RightInteractiveDelete} * * @throws Exception the exception */ @Test - public void testRoleHasRightInteracitveDelete() throws Exception + public void testRoleHasRightInteractiveDelete() throws Exception { IBmObject top = getTopObjectByFqn(FQN_FORBIDDEN_RIGHTS, dtProject); assertTrue(top instanceof RoleDescription); @@ -114,12 +116,28 @@ public class RoleRightHasForbiddenTest } /** - * Test role has forbidden right, check {@link RightInteracitveDeleteMarkedPredefinedData} + * Test role has forbidden right in FullAccess role, check {@link RightInteractiveDelete} * * @throws Exception the exception */ @Test - public void testRoleHasRightInteracitveDeleteMarkedPredefinedData() throws Exception + public void testRoleHasRightInteractiveDelete2() throws Exception + { + IBmObject top = getTopObjectByFqn(FQN_FORBIDDEN_RIGHTS2, dtProject); + assertTrue(top instanceof RoleDescription); + + Marker marker = getFirstMarker(CHECK_ID_1, top, dtProject); + assertNotNull(marker); + + } + + /** + * Test role has forbidden right, check {@link RightInteractiveDeleteMarkedPredefinedData} + * + * @throws Exception the exception + */ + @Test + public void testRoleHasRightInteractiveDeleteMarkedPredefinedData() throws Exception { IBmObject top = getTopObjectByFqn(FQN_FORBIDDEN_RIGHTS, dtProject); assertTrue(top instanceof RoleDescription); @@ -135,12 +153,12 @@ public class RoleRightHasForbiddenTest } /** - * Test role has forbidden right, check {@link RightInteracitveDeletePredefinedData} + * Test role has forbidden right, check {@link RightInteractiveDeletePredefinedData} * * @throws Exception the exception */ @Test - public void testRoleHasRightInteracitveDeletePredefinedData() throws Exception + public void testRoleHasRightInteractiveDeletePredefinedData() throws Exception { IBmObject top = getTopObjectByFqn(FQN_FORBIDDEN_RIGHTS, dtProject); assertTrue(top instanceof RoleDescription); @@ -198,12 +216,12 @@ public class RoleRightHasForbiddenTest } /** - * Test role has no forbidden right, check {@link RightInteracitveDelete} + * Test role has no forbidden right, check {@link RightInteractiveDelete} * * @throws Exception the exception */ @Test - public void testRoleHasNoRightInteracitveDelete() throws Exception + public void testRoleHasNoRightInteractiveDelete() throws Exception { IBmObject top = getTopObjectByFqn(FQN_ALLOWED_RIGHTS, dtProject); assertTrue(top instanceof RoleDescription); @@ -220,12 +238,12 @@ public class RoleRightHasForbiddenTest } /** - * Test role has no forbidden right, check {@link RightInteracitveDeleteMarkedPredefinedData} + * Test role has no forbidden right, check {@link RightInteractiveDeleteMarkedPredefinedData} * * @throws Exception the exception */ @Test - public void testRoleHasNoRightInteracitveDeleteMarkedPredefinedData() throws Exception + public void testRoleHasNoRightInteractiveDeleteMarkedPredefinedData() throws Exception { IBmObject top = getTopObjectByFqn(FQN_ALLOWED_RIGHTS, dtProject); assertTrue(top instanceof RoleDescription); @@ -242,12 +260,12 @@ public class RoleRightHasForbiddenTest } /** - * Test role has no forbidden right, check {@link RightInteracitveDeletePredefinedData} + * Test role has no forbidden right, check {@link RightInteractiveDeletePredefinedData} * * @throws Exception the exception */ @Test - public void testRoleHasNoRightInteracitveDeletePredefinedData() throws Exception + public void testRoleHasNoRightInteractiveDeletePredefinedData() throws Exception { IBmObject top = getTopObjectByFqn(FQN_ALLOWED_RIGHTS, dtProject); assertTrue(top instanceof RoleDescription); From 1745fbd0a37176b9b5f6e14d701cdfdbb237502f Mon Sep 17 00:00:00 2001 From: Dmitriy Marmyshev Date: Mon, 25 Jul 2022 20:27:27 +0300 Subject: [PATCH 2/2] =?UTF-8?q?=D0=9E=D1=82=D0=BA=D0=BB=D1=8E=D1=87=D0=B5?= =?UTF-8?q?=D0=BD=D0=B8=D0=B5=20=D0=BF=D1=80=D0=BE=D0=B2=D0=B5=D1=80=D0=BE?= =?UTF-8?q?=D0=BA=20=D0=B4=D0=BB=D1=8F=20=D0=B7=D0=B0=D0=B8=D0=BC=D1=81?= =?UTF-8?q?=D1=82=D0=B2=D0=BE=D0=B2=D0=B0=D0=BD=D0=BD=D1=8B=D1=85=20=D0=BE?= =?UTF-8?q?=D0=B1=D1=8A=D0=B5=D0=BA=D1=82=D0=BE=D0=B2=20=D0=B2=20=D1=80?= =?UTF-8?q?=D0=B0=D1=81=D1=88=D0=B8=D1=80=D0=B5=D0=BD=D0=B8=D0=B8=20#1076?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 1 + .../md/check/CommonModuleNameCachedCheck.java | 1 + .../md/check/CommonModuleNameClient.java | 1 + .../CommonModuleNameClientCachedCheck.java | 1 + .../check/CommonModuleNameClientServer.java | 1 + .../md/check/CommonModuleNameGlobal.java | 1 + ...CommonModuleNameServerCallCachedCheck.java | 1 + .../CommonModuleNameServerCallCheck.java | 1 + .../md/check/CommonModuleType.java | 1 + .../md/check/DbObjectAnyRefTypeCheck.java | 1 + .../md/check/DbObjectRefNonRefTypesCheck.java | 1 + .../check/MdListObjectPresentationCheck.java | 3 +- .../md/check/MdObjectNameLength.java | 1 + .../check/MdScheduledJobDescriptionCheck.java | 1 + .../check/MdScheduledJobPeriodicityCheck.java | 1 + .../MdStandardAttributeSynonymEmpty.java | 1 + ...ipAdoptedInExtensionMdObjectExtension.java | 41 +++++++++++++++++++ .../check/SubsystemSynonymTooLongCheck.java | 4 ++ 18 files changed, 62 insertions(+), 1 deletion(-) create mode 100644 bundles/com.e1c.v8codestyle.md/src/com/e1c/v8codestyle/md/check/SkipAdoptedInExtensionMdObjectExtension.java diff --git a/CHANGELOG.md b/CHANGELOG.md index 3fc8b131..2f443cd5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -77,6 +77,7 @@ - Некорректное сообщение об ошибке в строгих типах. Не существует типа "Таблица" #1055 - Ложное сообщение об ошибке о неиспользовании составных типов для стандартных объектов метаданных #1069 - Проверка: right-... не находит ошибку для роли с включением по умолчанию #815 +- Отключение проверок для заимствованных объектов в расширении #1076 ## 0.2.0 diff --git a/bundles/com.e1c.v8codestyle.md/src/com/e1c/v8codestyle/md/check/CommonModuleNameCachedCheck.java b/bundles/com.e1c.v8codestyle.md/src/com/e1c/v8codestyle/md/check/CommonModuleNameCachedCheck.java index b6568bf6..f8cd974a 100644 --- a/bundles/com.e1c.v8codestyle.md/src/com/e1c/v8codestyle/md/check/CommonModuleNameCachedCheck.java +++ b/bundles/com.e1c.v8codestyle.md/src/com/e1c/v8codestyle/md/check/CommonModuleNameCachedCheck.java @@ -76,6 +76,7 @@ public final class CommonModuleNameCachedCheck .issueType(IssueType.WARNING) .extension(new StandardCheckExtension(getCheckId(), CorePlugin.PLUGIN_ID)) .extension(new TopObjectFilterExtension()) + .extension(new SkipAdoptedInExtensionMdObjectExtension()) .topObject(COMMON_MODULE) .checkTop() .features(MD_OBJECT__NAME, COMMON_MODULE__RETURN_VALUES_REUSE); diff --git a/bundles/com.e1c.v8codestyle.md/src/com/e1c/v8codestyle/md/check/CommonModuleNameClient.java b/bundles/com.e1c.v8codestyle.md/src/com/e1c/v8codestyle/md/check/CommonModuleNameClient.java index 9f447365..8de72b92 100644 --- a/bundles/com.e1c.v8codestyle.md/src/com/e1c/v8codestyle/md/check/CommonModuleNameClient.java +++ b/bundles/com.e1c.v8codestyle.md/src/com/e1c/v8codestyle/md/check/CommonModuleNameClient.java @@ -74,6 +74,7 @@ public final class CommonModuleNameClient .extension(new TopObjectFilterExtension()) .extension(new MdObjectNameWithoutSuffix(NAME_SUFFIX_DEFAULT)) .extension(new StandardCheckExtension(getCheckId(), CorePlugin.PLUGIN_ID)) + .extension(new SkipAdoptedInExtensionMdObjectExtension()) .topObject(COMMON_MODULE) .checkTop() .features(MD_OBJECT__NAME, diff --git a/bundles/com.e1c.v8codestyle.md/src/com/e1c/v8codestyle/md/check/CommonModuleNameClientCachedCheck.java b/bundles/com.e1c.v8codestyle.md/src/com/e1c/v8codestyle/md/check/CommonModuleNameClientCachedCheck.java index 8be17a1f..7a6d443a 100644 --- a/bundles/com.e1c.v8codestyle.md/src/com/e1c/v8codestyle/md/check/CommonModuleNameClientCachedCheck.java +++ b/bundles/com.e1c.v8codestyle.md/src/com/e1c/v8codestyle/md/check/CommonModuleNameClientCachedCheck.java @@ -76,6 +76,7 @@ public final class CommonModuleNameClientCachedCheck .issueType(IssueType.WARNING) .extension(new StandardCheckExtension(getCheckId(), CorePlugin.PLUGIN_ID)) .extension(new TopObjectFilterExtension()) + .extension(new SkipAdoptedInExtensionMdObjectExtension()) .topObject(COMMON_MODULE) .checkTop() .features(MD_OBJECT__NAME, COMMON_MODULE__RETURN_VALUES_REUSE); diff --git a/bundles/com.e1c.v8codestyle.md/src/com/e1c/v8codestyle/md/check/CommonModuleNameClientServer.java b/bundles/com.e1c.v8codestyle.md/src/com/e1c/v8codestyle/md/check/CommonModuleNameClientServer.java index 101844e1..0222ad9c 100644 --- a/bundles/com.e1c.v8codestyle.md/src/com/e1c/v8codestyle/md/check/CommonModuleNameClientServer.java +++ b/bundles/com.e1c.v8codestyle.md/src/com/e1c/v8codestyle/md/check/CommonModuleNameClientServer.java @@ -75,6 +75,7 @@ public final class CommonModuleNameClientServer .extension(new TopObjectFilterExtension()) .extension(new MdObjectNameWithoutSuffix(NAME_SUFFIX_DEFAULT)) .extension(new StandardCheckExtension(getCheckId(), CorePlugin.PLUGIN_ID)) + .extension(new SkipAdoptedInExtensionMdObjectExtension()) .topObject(COMMON_MODULE) .checkTop() .features(MD_OBJECT__NAME, diff --git a/bundles/com.e1c.v8codestyle.md/src/com/e1c/v8codestyle/md/check/CommonModuleNameGlobal.java b/bundles/com.e1c.v8codestyle.md/src/com/e1c/v8codestyle/md/check/CommonModuleNameGlobal.java index 36a750e5..665bdd3f 100644 --- a/bundles/com.e1c.v8codestyle.md/src/com/e1c/v8codestyle/md/check/CommonModuleNameGlobal.java +++ b/bundles/com.e1c.v8codestyle.md/src/com/e1c/v8codestyle/md/check/CommonModuleNameGlobal.java @@ -74,6 +74,7 @@ public final class CommonModuleNameGlobal .extension(new TopObjectFilterExtension()) .extension(new MdObjectNameWithoutSuffix(NAME_SUFFIX_DEFAULT)) .extension(new StandardCheckExtension(getCheckId(), CorePlugin.PLUGIN_ID)) + .extension(new SkipAdoptedInExtensionMdObjectExtension()) .topObject(COMMON_MODULE) .checkTop() .features(MD_OBJECT__NAME, diff --git a/bundles/com.e1c.v8codestyle.md/src/com/e1c/v8codestyle/md/check/CommonModuleNameServerCallCachedCheck.java b/bundles/com.e1c.v8codestyle.md/src/com/e1c/v8codestyle/md/check/CommonModuleNameServerCallCachedCheck.java index f6aa4220..c77b5b4d 100644 --- a/bundles/com.e1c.v8codestyle.md/src/com/e1c/v8codestyle/md/check/CommonModuleNameServerCallCachedCheck.java +++ b/bundles/com.e1c.v8codestyle.md/src/com/e1c/v8codestyle/md/check/CommonModuleNameServerCallCachedCheck.java @@ -76,6 +76,7 @@ public final class CommonModuleNameServerCallCachedCheck .issueType(IssueType.WARNING) .extension(new StandardCheckExtension(getCheckId(), CorePlugin.PLUGIN_ID)) .extension(new TopObjectFilterExtension()) + .extension(new SkipAdoptedInExtensionMdObjectExtension()) .topObject(COMMON_MODULE) .checkTop() .features(MD_OBJECT__NAME, COMMON_MODULE__RETURN_VALUES_REUSE); diff --git a/bundles/com.e1c.v8codestyle.md/src/com/e1c/v8codestyle/md/check/CommonModuleNameServerCallCheck.java b/bundles/com.e1c.v8codestyle.md/src/com/e1c/v8codestyle/md/check/CommonModuleNameServerCallCheck.java index 17214d5a..3b2b4c77 100644 --- a/bundles/com.e1c.v8codestyle.md/src/com/e1c/v8codestyle/md/check/CommonModuleNameServerCallCheck.java +++ b/bundles/com.e1c.v8codestyle.md/src/com/e1c/v8codestyle/md/check/CommonModuleNameServerCallCheck.java @@ -75,6 +75,7 @@ public final class CommonModuleNameServerCallCheck .issueType(IssueType.WARNING) .extension(new StandardCheckExtension(getCheckId(), CorePlugin.PLUGIN_ID)) .extension(new TopObjectFilterExtension()) + .extension(new SkipAdoptedInExtensionMdObjectExtension()) .topObject(COMMON_MODULE) .checkTop() .features(MD_OBJECT__NAME, COMMON_MODULE__SERVER_CALL); diff --git a/bundles/com.e1c.v8codestyle.md/src/com/e1c/v8codestyle/md/check/CommonModuleType.java b/bundles/com.e1c.v8codestyle.md/src/com/e1c/v8codestyle/md/check/CommonModuleType.java index 969167f3..1e2cb504 100644 --- a/bundles/com.e1c.v8codestyle.md/src/com/e1c/v8codestyle/md/check/CommonModuleType.java +++ b/bundles/com.e1c.v8codestyle.md/src/com/e1c/v8codestyle/md/check/CommonModuleType.java @@ -85,6 +85,7 @@ public final class CommonModuleType .issueType(IssueType.CODE_STYLE) .extension(new TopObjectFilterExtension()) .extension(new StandardCheckExtension(getCheckId(), CorePlugin.PLUGIN_ID)) + .extension(new SkipAdoptedInExtensionMdObjectExtension()) .topObject(COMMON_MODULE) .checkTop() .features(CommonModuleTypes.SERVER.getFeatureValues(false).keySet().toArray(new EStructuralFeature[0])); diff --git a/bundles/com.e1c.v8codestyle.md/src/com/e1c/v8codestyle/md/check/DbObjectAnyRefTypeCheck.java b/bundles/com.e1c.v8codestyle.md/src/com/e1c/v8codestyle/md/check/DbObjectAnyRefTypeCheck.java index 61e634e9..efb985e3 100644 --- a/bundles/com.e1c.v8codestyle.md/src/com/e1c/v8codestyle/md/check/DbObjectAnyRefTypeCheck.java +++ b/bundles/com.e1c.v8codestyle.md/src/com/e1c/v8codestyle/md/check/DbObjectAnyRefTypeCheck.java @@ -76,6 +76,7 @@ public final class DbObjectAnyRefTypeCheck .severity(IssueSeverity.MAJOR) .issueType(IssueType.PERFORMANCE) .extension(new StandardCheckExtension(getCheckId(), CorePlugin.PLUGIN_ID)) + .extension(new SkipAdoptedInExtensionMdObjectExtension()) .topObject(BASIC_DB_OBJECT) .containment(TYPE_DESCRIPTION) .features(TYPE_DESCRIPTION__TYPES); diff --git a/bundles/com.e1c.v8codestyle.md/src/com/e1c/v8codestyle/md/check/DbObjectRefNonRefTypesCheck.java b/bundles/com.e1c.v8codestyle.md/src/com/e1c/v8codestyle/md/check/DbObjectRefNonRefTypesCheck.java index 3fa826b7..3de41aad 100644 --- a/bundles/com.e1c.v8codestyle.md/src/com/e1c/v8codestyle/md/check/DbObjectRefNonRefTypesCheck.java +++ b/bundles/com.e1c.v8codestyle.md/src/com/e1c/v8codestyle/md/check/DbObjectRefNonRefTypesCheck.java @@ -86,6 +86,7 @@ public final class DbObjectRefNonRefTypesCheck .severity(IssueSeverity.MAJOR) .issueType(IssueType.PERFORMANCE) .extension(new StandardCheckExtension(getCheckId(), CorePlugin.PLUGIN_ID)) + .extension(new SkipAdoptedInExtensionMdObjectExtension()) .topObject(BASIC_DB_OBJECT) .containment(TYPE_DESCRIPTION) .features(TYPE_DESCRIPTION__TYPES); diff --git a/bundles/com.e1c.v8codestyle.md/src/com/e1c/v8codestyle/md/check/MdListObjectPresentationCheck.java b/bundles/com.e1c.v8codestyle.md/src/com/e1c/v8codestyle/md/check/MdListObjectPresentationCheck.java index 40c5b235..771a7aed 100644 --- a/bundles/com.e1c.v8codestyle.md/src/com/e1c/v8codestyle/md/check/MdListObjectPresentationCheck.java +++ b/bundles/com.e1c.v8codestyle.md/src/com/e1c/v8codestyle/md/check/MdListObjectPresentationCheck.java @@ -84,7 +84,8 @@ public class MdListObjectPresentationCheck .severity(IssueSeverity.MINOR) .extension(new TopObjectFilterExtension()) .issueType(IssueType.UI_STYLE) - .extension(new StandardCheckExtension(getCheckId(), CorePlugin.PLUGIN_ID)); + .extension(new StandardCheckExtension(getCheckId(), CorePlugin.PLUGIN_ID)) + .extension(new SkipAdoptedInExtensionMdObjectExtension()); builder.topObject(BASIC_DB_OBJECT) .checkTop() diff --git a/bundles/com.e1c.v8codestyle.md/src/com/e1c/v8codestyle/md/check/MdObjectNameLength.java b/bundles/com.e1c.v8codestyle.md/src/com/e1c/v8codestyle/md/check/MdObjectNameLength.java index 0a73afd3..e0305730 100644 --- a/bundles/com.e1c.v8codestyle.md/src/com/e1c/v8codestyle/md/check/MdObjectNameLength.java +++ b/bundles/com.e1c.v8codestyle.md/src/com/e1c/v8codestyle/md/check/MdObjectNameLength.java @@ -60,6 +60,7 @@ public final class MdObjectNameLength .extension(new TopObjectFilterExtension()) .issueType(IssueType.PORTABILITY) .extension(new CommonSenseCheckExtension(getCheckId(), CorePlugin.PLUGIN_ID)) + .extension(new SkipAdoptedInExtensionMdObjectExtension()) .topObject(MD_OBJECT) .checkTop() .features(MD_OBJECT__NAME) diff --git a/bundles/com.e1c.v8codestyle.md/src/com/e1c/v8codestyle/md/check/MdScheduledJobDescriptionCheck.java b/bundles/com.e1c.v8codestyle.md/src/com/e1c/v8codestyle/md/check/MdScheduledJobDescriptionCheck.java index b52698da..3ce0e986 100644 --- a/bundles/com.e1c.v8codestyle.md/src/com/e1c/v8codestyle/md/check/MdScheduledJobDescriptionCheck.java +++ b/bundles/com.e1c.v8codestyle.md/src/com/e1c/v8codestyle/md/check/MdScheduledJobDescriptionCheck.java @@ -56,6 +56,7 @@ public class MdScheduledJobDescriptionCheck .severity(IssueSeverity.MINOR) .issueType(IssueType.UI_STYLE) .extension(new StandardCheckExtension(getCheckId(), CorePlugin.PLUGIN_ID)) + .extension(new SkipAdoptedInExtensionMdObjectExtension()) .topObject(SCHEDULED_JOB) .checkTop() .features(SCHEDULED_JOB__DESCRIPTION, SCHEDULED_JOB__PREDEFINED); diff --git a/bundles/com.e1c.v8codestyle.md/src/com/e1c/v8codestyle/md/check/MdScheduledJobPeriodicityCheck.java b/bundles/com.e1c.v8codestyle.md/src/com/e1c/v8codestyle/md/check/MdScheduledJobPeriodicityCheck.java index 4e8b0c8f..808b79ca 100644 --- a/bundles/com.e1c.v8codestyle.md/src/com/e1c/v8codestyle/md/check/MdScheduledJobPeriodicityCheck.java +++ b/bundles/com.e1c.v8codestyle.md/src/com/e1c/v8codestyle/md/check/MdScheduledJobPeriodicityCheck.java @@ -124,6 +124,7 @@ public final class MdScheduledJobPeriodicityCheck .severity(IssueSeverity.MAJOR) .issueType(IssueType.PERFORMANCE) .extension(new StandardCheckExtension(getCheckId(), CorePlugin.PLUGIN_ID)) + .extension(new SkipAdoptedInExtensionMdObjectExtension()) .topObject(SCHEDULE) .checkTop() .containment(DAILY_SCHEDULE) diff --git a/bundles/com.e1c.v8codestyle.md/src/com/e1c/v8codestyle/md/check/MdStandardAttributeSynonymEmpty.java b/bundles/com.e1c.v8codestyle.md/src/com/e1c/v8codestyle/md/check/MdStandardAttributeSynonymEmpty.java index bcf4636f..19598e33 100644 --- a/bundles/com.e1c.v8codestyle.md/src/com/e1c/v8codestyle/md/check/MdStandardAttributeSynonymEmpty.java +++ b/bundles/com.e1c.v8codestyle.md/src/com/e1c/v8codestyle/md/check/MdStandardAttributeSynonymEmpty.java @@ -95,6 +95,7 @@ public class MdStandardAttributeSynonymEmpty .issueType(IssueType.UI_STYLE) .extension(new TopObjectFilterExtension()) .extension(new StandardCheckExtension(getCheckId(), CorePlugin.PLUGIN_ID)) + .extension(new SkipAdoptedInExtensionMdObjectExtension()) .extension(new CatalogChangeExtension()); builder.topObject(CATALOG).containment(STANDARD_ATTRIBUTE).features(STANDARD_ATTRIBUTE__SYNONYM); diff --git a/bundles/com.e1c.v8codestyle.md/src/com/e1c/v8codestyle/md/check/SkipAdoptedInExtensionMdObjectExtension.java b/bundles/com.e1c.v8codestyle.md/src/com/e1c/v8codestyle/md/check/SkipAdoptedInExtensionMdObjectExtension.java new file mode 100644 index 00000000..2b43035f --- /dev/null +++ b/bundles/com.e1c.v8codestyle.md/src/com/e1c/v8codestyle/md/check/SkipAdoptedInExtensionMdObjectExtension.java @@ -0,0 +1,41 @@ +/******************************************************************************* + * Copyright (C) 2022, 1C-Soft LLC and others. + * + * This program and the accompanying materials are made + * available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * 1C-Soft LLC - initial API and implementation + *******************************************************************************/ +package com.e1c.v8codestyle.md.check; + +import com._1c.g5.v8.dt.metadata.mdclass.MdObject; +import com._1c.g5.v8.dt.metadata.mdclass.ObjectBelonging; +import com.e1c.g5.v8.dt.check.components.IBasicCheckExtension; +import com.e1c.g5.v8.dt.check.ext.ITopObjectFilter; + +/** + * The extension skips TOP MD object that adopted in Extension Configuration. + * + * @author Dmitriy Marmyshev + */ +public class SkipAdoptedInExtensionMdObjectExtension + implements IBasicCheckExtension +{ + @Override + public ITopObjectFilter contributeTopObjectFilter() + { + return (object, parameters) -> { + + if (object instanceof MdObject) + { + return ((MdObject)object).getObjectBelonging() != ObjectBelonging.ADOPTED; + } + return true; + }; + } + +} diff --git a/bundles/com.e1c.v8codestyle.md/src/com/e1c/v8codestyle/md/check/SubsystemSynonymTooLongCheck.java b/bundles/com.e1c.v8codestyle.md/src/com/e1c/v8codestyle/md/check/SubsystemSynonymTooLongCheck.java index 1199d68a..02f40a0c 100644 --- a/bundles/com.e1c.v8codestyle.md/src/com/e1c/v8codestyle/md/check/SubsystemSynonymTooLongCheck.java +++ b/bundles/com.e1c.v8codestyle.md/src/com/e1c/v8codestyle/md/check/SubsystemSynonymTooLongCheck.java @@ -33,6 +33,8 @@ import com.e1c.g5.v8.dt.check.components.BasicCheck; import com.e1c.g5.v8.dt.check.components.TopObjectFilterExtension; import com.e1c.g5.v8.dt.check.settings.IssueSeverity; import com.e1c.g5.v8.dt.check.settings.IssueType; +import com.e1c.v8codestyle.check.StandardCheckExtension; +import com.e1c.v8codestyle.internal.md.CorePlugin; /** * Check top subsystem synonym length that should be less then 35 by default or value @@ -70,6 +72,8 @@ public class SubsystemSynonymTooLongCheck .complexity(CheckComplexity.NORMAL) .severity(IssueSeverity.MINOR) .extension(new TopObjectFilterExtension()) + .extension(new StandardCheckExtension(getCheckId(), CorePlugin.PLUGIN_ID)) + .extension(new SkipAdoptedInExtensionMdObjectExtension()) .issueType(IssueType.UI_STYLE) .topObject(SUBSYSTEM) .checkTop()