Skip to content

Commit

Permalink
Finish 0.14.0
Browse files Browse the repository at this point in the history
  • Loading branch information
theshadowco committed Jul 11, 2024
2 parents 07d009d + d77a503 commit 6e6efa6
Show file tree
Hide file tree
Showing 379 changed files with 27,992 additions and 5,346 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/gh-pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ jobs:
cp -R temp/site/. public/dev/en
- name: Deploy
uses: peaceiris/actions-gh-pages@v3.9.3
uses: peaceiris/actions-gh-pages@v4.0.0
with:
deploy_key: ${{ secrets.ACTIONS_DEPLOY_KEY }}
publish_branch: gh-pages
Expand Down
4 changes: 2 additions & 2 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ plugins {
id("io.freefair.javadoc-utf-8") version "8.6"
id("io.freefair.maven-central.validate-poms") version "8.6"
id("ru.vyarus.pom") version "3.0.0"
id("org.sonarqube") version "5.0.0.4638"
id("org.sonarqube") version "5.1.0.4882"
id("io.codearte.nexus-staging") version "0.30.0"
}

Expand Down Expand Up @@ -56,7 +56,7 @@ dependencies {
// прочее
implementation("commons-io", "commons-io", "2.8.0")
implementation("io.github.1c-syntax", "utils", "0.6.1")
implementation("io.github.1c-syntax", "bsl-common-library", "0.6.0")
implementation("io.github.1c-syntax", "bsl-common-library", "0.7.0")
implementation("io.github.1c-syntax", "supportconf", "0.14.0") {
exclude("io.github.1c-syntax", "bsl-common-library")
}
Expand Down
23 changes: 22 additions & 1 deletion src/main/java/com/github/_1c_syntax/bsl/mdclasses/CF.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
*/
package com.github._1c_syntax.bsl.mdclasses;

import com.github._1c_syntax.bsl.mdo.CommonModule;
import com.github._1c_syntax.bsl.mdo.MD;
import com.github._1c_syntax.bsl.mdo.Module;
import com.github._1c_syntax.bsl.mdo.ModuleOwner;
Expand All @@ -38,7 +39,7 @@
import java.util.Map;
import java.util.Optional;

public interface CF extends MDClass, ConfigurationTree {
public interface CF extends MDClass, ConfigurationTree, CFAccess {

/**
* Язык приложения по умолчанию
Expand Down Expand Up @@ -90,6 +91,16 @@ public interface CF extends MDClass, ConfigurationTree {
*/
Map<URI, Module> getModulesByURI();

/**
* Возвращает соответствие имени общего модуля к нему самому
*/
Map<String, CommonModule> getCommonModulesByName();

/**
* Возвращает соответствие ссылки на дочерний объект к нему самому
*/
Map<MdoReference, MD> getChildrenByMdoRef();

/**
* Возвращает соответствие типов модулей их путям к файлам для дочернего объекта
*/
Expand Down Expand Up @@ -158,4 +169,14 @@ default Optional<Module> getModuleByUri(URI uri) {
default Optional<MD> findChild(URI uri) {
return Optional.ofNullable(getModulesByObject().get(uri));
}

@Override
default Optional<MD> findChild(MdoReference ref) {
return Optional.ofNullable(getChildrenByMdoRef().get(ref));
}

@Override
default Optional<CommonModule> findCommonModule(String name) {
return Optional.ofNullable(getCommonModulesByName().get(name));
}
}
102 changes: 102 additions & 0 deletions src/main/java/com/github/_1c_syntax/bsl/mdclasses/CFAccess.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
/*
* This file is a part of MDClasses.
*
* Copyright (c) 2019 - 2024
* Tymko Oleg <[email protected]>, Maximov Valery <[email protected]> and contributors
*
* SPDX-License-Identifier: LGPL-3.0-or-later
*
* MDClasses is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3.0 of the License, or (at your option) any later version.
*
* MDClasses is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with MDClasses.
*/
package com.github._1c_syntax.bsl.mdclasses;


import com.github._1c_syntax.bsl.mdclasses.helpers.Rights;
import com.github._1c_syntax.bsl.mdo.AccessRightsOwner;
import com.github._1c_syntax.bsl.mdo.MD;
import com.github._1c_syntax.bsl.mdo.Role;
import com.github._1c_syntax.bsl.mdo.support.RoleRight;
import com.github._1c_syntax.bsl.types.MdoReference;

import java.util.List;

/**
* Расширение - права доступа
*/
public interface CFAccess extends AccessRightsOwner {

/**
* Проверяет наличие указанного разрешения хотя бы у одной роли для конфигурации/расширения
*
* @param roleRight Право доступа
* @return Наличие права доступа
*/
default boolean rightAccess(RoleRight roleRight) {
return Rights.rightAccess((CF) this, roleRight);
}

/**
* Проверяет наличие указанного разрешения хотя бы у одной роли для MD
*
* @param roleRight Право доступа
* @param md Любой объект md
* @return Наличие права доступа
*/
default boolean rightAccess(RoleRight roleRight, MD md) {
return Rights.rightAccess((CF) this, roleRight, md);
}

/**
* Проверяет наличие указанного разрешения хотя бы у одной роли для ссылки
*
* @param roleRight Право доступа
* @param mdoReference Ссылка mdo reference
* @return Наличие права доступа
*/
default boolean rightAccess(RoleRight roleRight, MdoReference mdoReference) {
return Rights.rightAccess((CF) this, roleRight, mdoReference);
}

/**
* Возвращает список ролей, имеющих указанное разрешения для конфигурации/расширения
*
* @param roleRight Право доступа
* @return Список ролей с правом
*/
default List<Role> rolesAccess(RoleRight roleRight) {
return Rights.rolesAccess((CF) this, roleRight);
}

/**
* Возвращает список ролей, имеющих указанное разрешения для md
*
* @param roleRight Право доступа
* @param md Любой объект md
* @return Список ролей с правом
*/
default List<Role> rolesAccess(RoleRight roleRight, MD md) {
return Rights.rolesAccess((CF) this, roleRight, md);
}

/**
* Возвращает список ролей, имеющих указанное разрешения для ссылки
*
* @param roleRight Право доступа
* @param mdoReference Ссылка mdo reference
* @return Список ролей с правом
*/
default List<Role> rolesAccess(RoleRight roleRight, MdoReference mdoReference) {
return Rights.rolesAccess((CF) this, roleRight, mdoReference);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@
import com.github._1c_syntax.bsl.mdo.support.DataLockControlMode;
import com.github._1c_syntax.bsl.mdo.support.MultiLanguageString;
import com.github._1c_syntax.bsl.mdo.support.ObjectBelonging;
import com.github._1c_syntax.bsl.mdo.support.RoleRight;
import com.github._1c_syntax.bsl.mdo.support.ScriptVariant;
import com.github._1c_syntax.bsl.mdo.support.UseMode;
import com.github._1c_syntax.bsl.mdo.support.UsePurposes;
Expand Down Expand Up @@ -112,6 +113,8 @@ public class Configuration implements CF {
*/
public static final Configuration EMPTY = createEmptyConfiguration();

private static final List<RoleRight> POSSIBLE_RIGHTS = computePossibleRighs();

/*
* CF
*/
Expand Down Expand Up @@ -254,6 +257,8 @@ public class Configuration implements CF {
Lazy<Map<URI, ModuleType>> modulesByType = new Lazy<>(this::computeModulesByType);
Lazy<Map<URI, Module>> modulesByURI = new Lazy<>(this::computeModulesByURI);
Lazy<Map<URI, MD>> modulesByObject = new Lazy<>(this::computeModulesByObject);
Lazy<Map<String, CommonModule>> commonModulesByName = new Lazy<>(this::computeCommonModulesByName);
Lazy<Map<MdoReference, MD>> childrenByMdoRef = new Lazy<>(this::computeChildrenByMdoRef);

/*
* Свое
Expand Down Expand Up @@ -342,6 +347,23 @@ public Map<URI, Module> getModulesByURI() {
return modulesByURI.getOrCompute();
}

@Override
public Map<String, CommonModule> getCommonModulesByName() {
return commonModulesByName.getOrCompute();
}

@Override
public Map<MdoReference, MD> getChildrenByMdoRef() {
return childrenByMdoRef.getOrCompute();
}

/**
* Возвращает перечень возможных прав доступа
*/
public static List<RoleRight> possibleRights() {
return POSSIBLE_RIGHTS;
}

private List<MD> computePlainChildren() {
return LazyLoader.computePlainChildren(this);
}
Expand All @@ -362,6 +384,14 @@ private Map<URI, Module> computeModulesByURI() {
return LazyLoader.computeModulesByURI(this);
}

private Map<String, CommonModule> computeCommonModulesByName() {
return LazyLoader.computeCommonModulesByName(this);
}

private Map<MdoReference, MD> computeChildrenByMdoRef() {
return LazyLoader.computeChildrenByMdoRef(this);
}

private static Configuration createEmptyConfiguration() {
var emptyString = "empty";

Expand All @@ -371,4 +401,35 @@ private static Configuration createEmptyConfiguration() {
.uuid(emptyString)
.build();
}

private static List<RoleRight> computePossibleRighs() {
return List.of(
RoleRight.ADMINISTRATION,
RoleRight.DATA_ADMINISTRATION,
RoleRight.UPDATE_DATA_BASE_CONFIGURATION,
RoleRight.EXCLUSIVE_MODE,
RoleRight.ACTIVE_USERS,
RoleRight.EVENT_LOG,
RoleRight.THIN_CLIENT,
RoleRight.WEB_CLIENT,
RoleRight.MOBILE_CLIENT,
RoleRight.THICK_CLIENT,
RoleRight.EXTERNAL_CONNECTION,
RoleRight.AUTOMATION,
RoleRight.TECHNICAL_SPECIALIST_MODE,
RoleRight.COLLABORATION_SYSTEM_INFO_BASE_REGISTRATION,
RoleRight.MAIN_WINDOW_MODE_EMBEDDED_WORKPLACE,
RoleRight.MAIN_WINDOW_MODE_KIOSK,
RoleRight.MAIN_WINDOW_MODE_NORMAL,
RoleRight.MAIN_WINDOW_MODE_FULLSCREEN_WORKPLACE,
RoleRight.MAIN_WINDOW_MODE_WORKPLACE,
RoleRight.ANALYTICS_SYSTEM_CLIENT,
RoleRight.EXCLUSIVE_MODE_TERMINATION_AT_SESSION_START,
RoleRight.SAVE_USER_DATA,
RoleRight.CONFIGURATION_EXTENSIONS_ADMINISTRATION,
RoleRight.INTERACTIVE_OPEN_EXT_DATA_PROCESSORS,
RoleRight.INTERACTIVE_OPEN_EXT_REPORTS,
RoleRight.OUTPUT
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@
import com.github._1c_syntax.bsl.mdo.support.ConfigurationExtensionPurpose;
import com.github._1c_syntax.bsl.mdo.support.MultiLanguageString;
import com.github._1c_syntax.bsl.mdo.support.ObjectBelonging;
import com.github._1c_syntax.bsl.mdo.support.RoleRight;
import com.github._1c_syntax.bsl.mdo.support.ScriptVariant;
import com.github._1c_syntax.bsl.mdo.support.UsePurposes;
import com.github._1c_syntax.bsl.mdo.utils.LazyLoader;
Expand Down Expand Up @@ -247,6 +248,8 @@ public class ConfigurationExtension implements CF {
Lazy<Map<URI, ModuleType>> modulesByType = new Lazy<>(this::computeModulesByType);
Lazy<Map<URI, MD>> modulesByObject = new Lazy<>(this::computeModulesByObject);
Lazy<Map<URI, Module>> modulesByURI = new Lazy<>(this::computeModulesByURI);
Lazy<Map<String, CommonModule>> commonModulesByName = new Lazy<>(this::computeCommonModulesByName);
Lazy<Map<MdoReference, MD>> childrenByMdoRef = new Lazy<>(this::computeChildrenByMdoRef);

/*
* Свое
Expand Down Expand Up @@ -289,6 +292,23 @@ public Map<URI, Module> getModulesByURI() {
return modulesByURI.getOrCompute();
}

@Override
public Map<String, CommonModule> getCommonModulesByName() {
return commonModulesByName.getOrCompute();
}

@Override
public Map<MdoReference, MD> getChildrenByMdoRef() {
return childrenByMdoRef.getOrCompute();
}

/**
* Возвращает перечень возможных прав доступа
*/
public static List<RoleRight> possibleRights() {
return Configuration.possibleRights();
}

private List<MD> computePlainChildren() {
return LazyLoader.computePlainChildren(this);
}
Expand All @@ -301,7 +321,6 @@ private Map<URI, MD> computeModulesByObject() {
return LazyLoader.computeModulesByObject(this);
}


private List<Module> computeAllModules() {
return LazyLoader.computeAllModules(this);
}
Expand All @@ -310,4 +329,12 @@ private Map<URI, Module> computeModulesByURI() {
return LazyLoader.computeModulesByURI(this);
}

private Map<String, CommonModule> computeCommonModulesByName() {
return LazyLoader.computeCommonModulesByName(this);
}

private Map<MdoReference, MD> computeChildrenByMdoRef() {
return LazyLoader.computeChildrenByMdoRef(this);
}

}
Loading

0 comments on commit 6e6efa6

Please sign in to comment.