Skip to content

Commit 6e6efa6

Browse files
committed
Finish 0.14.0
2 parents 07d009d + d77a503 commit 6e6efa6

File tree

379 files changed

+27992
-5346
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

379 files changed

+27992
-5346
lines changed

.github/workflows/gh-pages.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ jobs:
124124
cp -R temp/site/. public/dev/en
125125
126126
- name: Deploy
127-
uses: peaceiris/actions-gh-pages@v3.9.3
127+
uses: peaceiris/actions-gh-pages@v4.0.0
128128
with:
129129
deploy_key: ${{ secrets.ACTIONS_DEPLOY_KEY }}
130130
publish_branch: gh-pages

build.gradle.kts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ plugins {
1414
id("io.freefair.javadoc-utf-8") version "8.6"
1515
id("io.freefair.maven-central.validate-poms") version "8.6"
1616
id("ru.vyarus.pom") version "3.0.0"
17-
id("org.sonarqube") version "5.0.0.4638"
17+
id("org.sonarqube") version "5.1.0.4882"
1818
id("io.codearte.nexus-staging") version "0.30.0"
1919
}
2020

@@ -56,7 +56,7 @@ dependencies {
5656
// прочее
5757
implementation("commons-io", "commons-io", "2.8.0")
5858
implementation("io.github.1c-syntax", "utils", "0.6.1")
59-
implementation("io.github.1c-syntax", "bsl-common-library", "0.6.0")
59+
implementation("io.github.1c-syntax", "bsl-common-library", "0.7.0")
6060
implementation("io.github.1c-syntax", "supportconf", "0.14.0") {
6161
exclude("io.github.1c-syntax", "bsl-common-library")
6262
}

src/main/java/com/github/_1c_syntax/bsl/mdclasses/CF.java

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
*/
2222
package com.github._1c_syntax.bsl.mdclasses;
2323

24+
import com.github._1c_syntax.bsl.mdo.CommonModule;
2425
import com.github._1c_syntax.bsl.mdo.MD;
2526
import com.github._1c_syntax.bsl.mdo.Module;
2627
import com.github._1c_syntax.bsl.mdo.ModuleOwner;
@@ -38,7 +39,7 @@
3839
import java.util.Map;
3940
import java.util.Optional;
4041

41-
public interface CF extends MDClass, ConfigurationTree {
42+
public interface CF extends MDClass, ConfigurationTree, CFAccess {
4243

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

94+
/**
95+
* Возвращает соответствие имени общего модуля к нему самому
96+
*/
97+
Map<String, CommonModule> getCommonModulesByName();
98+
99+
/**
100+
* Возвращает соответствие ссылки на дочерний объект к нему самому
101+
*/
102+
Map<MdoReference, MD> getChildrenByMdoRef();
103+
93104
/**
94105
* Возвращает соответствие типов модулей их путям к файлам для дочернего объекта
95106
*/
@@ -158,4 +169,14 @@ default Optional<Module> getModuleByUri(URI uri) {
158169
default Optional<MD> findChild(URI uri) {
159170
return Optional.ofNullable(getModulesByObject().get(uri));
160171
}
172+
173+
@Override
174+
default Optional<MD> findChild(MdoReference ref) {
175+
return Optional.ofNullable(getChildrenByMdoRef().get(ref));
176+
}
177+
178+
@Override
179+
default Optional<CommonModule> findCommonModule(String name) {
180+
return Optional.ofNullable(getCommonModulesByName().get(name));
181+
}
161182
}
Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
/*
2+
* This file is a part of MDClasses.
3+
*
4+
* Copyright (c) 2019 - 2024
5+
* Tymko Oleg <olegtymko@yandex.ru>, Maximov Valery <maximovvalery@gmail.com> and contributors
6+
*
7+
* SPDX-License-Identifier: LGPL-3.0-or-later
8+
*
9+
* MDClasses is free software; you can redistribute it and/or
10+
* modify it under the terms of the GNU Lesser General Public
11+
* License as published by the Free Software Foundation; either
12+
* version 3.0 of the License, or (at your option) any later version.
13+
*
14+
* MDClasses is distributed in the hope that it will be useful,
15+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
16+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17+
* Lesser General Public License for more details.
18+
*
19+
* You should have received a copy of the GNU Lesser General Public
20+
* License along with MDClasses.
21+
*/
22+
package com.github._1c_syntax.bsl.mdclasses;
23+
24+
25+
import com.github._1c_syntax.bsl.mdclasses.helpers.Rights;
26+
import com.github._1c_syntax.bsl.mdo.AccessRightsOwner;
27+
import com.github._1c_syntax.bsl.mdo.MD;
28+
import com.github._1c_syntax.bsl.mdo.Role;
29+
import com.github._1c_syntax.bsl.mdo.support.RoleRight;
30+
import com.github._1c_syntax.bsl.types.MdoReference;
31+
32+
import java.util.List;
33+
34+
/**
35+
* Расширение - права доступа
36+
*/
37+
public interface CFAccess extends AccessRightsOwner {
38+
39+
/**
40+
* Проверяет наличие указанного разрешения хотя бы у одной роли для конфигурации/расширения
41+
*
42+
* @param roleRight Право доступа
43+
* @return Наличие права доступа
44+
*/
45+
default boolean rightAccess(RoleRight roleRight) {
46+
return Rights.rightAccess((CF) this, roleRight);
47+
}
48+
49+
/**
50+
* Проверяет наличие указанного разрешения хотя бы у одной роли для MD
51+
*
52+
* @param roleRight Право доступа
53+
* @param md Любой объект md
54+
* @return Наличие права доступа
55+
*/
56+
default boolean rightAccess(RoleRight roleRight, MD md) {
57+
return Rights.rightAccess((CF) this, roleRight, md);
58+
}
59+
60+
/**
61+
* Проверяет наличие указанного разрешения хотя бы у одной роли для ссылки
62+
*
63+
* @param roleRight Право доступа
64+
* @param mdoReference Ссылка mdo reference
65+
* @return Наличие права доступа
66+
*/
67+
default boolean rightAccess(RoleRight roleRight, MdoReference mdoReference) {
68+
return Rights.rightAccess((CF) this, roleRight, mdoReference);
69+
}
70+
71+
/**
72+
* Возвращает список ролей, имеющих указанное разрешения для конфигурации/расширения
73+
*
74+
* @param roleRight Право доступа
75+
* @return Список ролей с правом
76+
*/
77+
default List<Role> rolesAccess(RoleRight roleRight) {
78+
return Rights.rolesAccess((CF) this, roleRight);
79+
}
80+
81+
/**
82+
* Возвращает список ролей, имеющих указанное разрешения для md
83+
*
84+
* @param roleRight Право доступа
85+
* @param md Любой объект md
86+
* @return Список ролей с правом
87+
*/
88+
default List<Role> rolesAccess(RoleRight roleRight, MD md) {
89+
return Rights.rolesAccess((CF) this, roleRight, md);
90+
}
91+
92+
/**
93+
* Возвращает список ролей, имеющих указанное разрешения для ссылки
94+
*
95+
* @param roleRight Право доступа
96+
* @param mdoReference Ссылка mdo reference
97+
* @return Список ролей с правом
98+
*/
99+
default List<Role> rolesAccess(RoleRight roleRight, MdoReference mdoReference) {
100+
return Rights.rolesAccess((CF) this, roleRight, mdoReference);
101+
}
102+
}

src/main/java/com/github/_1c_syntax/bsl/mdclasses/Configuration.java

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@
7474
import com.github._1c_syntax.bsl.mdo.support.DataLockControlMode;
7575
import com.github._1c_syntax.bsl.mdo.support.MultiLanguageString;
7676
import com.github._1c_syntax.bsl.mdo.support.ObjectBelonging;
77+
import com.github._1c_syntax.bsl.mdo.support.RoleRight;
7778
import com.github._1c_syntax.bsl.mdo.support.ScriptVariant;
7879
import com.github._1c_syntax.bsl.mdo.support.UseMode;
7980
import com.github._1c_syntax.bsl.mdo.support.UsePurposes;
@@ -112,6 +113,8 @@ public class Configuration implements CF {
112113
*/
113114
public static final Configuration EMPTY = createEmptyConfiguration();
114115

116+
private static final List<RoleRight> POSSIBLE_RIGHTS = computePossibleRighs();
117+
115118
/*
116119
* CF
117120
*/
@@ -254,6 +257,8 @@ public class Configuration implements CF {
254257
Lazy<Map<URI, ModuleType>> modulesByType = new Lazy<>(this::computeModulesByType);
255258
Lazy<Map<URI, Module>> modulesByURI = new Lazy<>(this::computeModulesByURI);
256259
Lazy<Map<URI, MD>> modulesByObject = new Lazy<>(this::computeModulesByObject);
260+
Lazy<Map<String, CommonModule>> commonModulesByName = new Lazy<>(this::computeCommonModulesByName);
261+
Lazy<Map<MdoReference, MD>> childrenByMdoRef = new Lazy<>(this::computeChildrenByMdoRef);
257262

258263
/*
259264
* Свое
@@ -342,6 +347,23 @@ public Map<URI, Module> getModulesByURI() {
342347
return modulesByURI.getOrCompute();
343348
}
344349

350+
@Override
351+
public Map<String, CommonModule> getCommonModulesByName() {
352+
return commonModulesByName.getOrCompute();
353+
}
354+
355+
@Override
356+
public Map<MdoReference, MD> getChildrenByMdoRef() {
357+
return childrenByMdoRef.getOrCompute();
358+
}
359+
360+
/**
361+
* Возвращает перечень возможных прав доступа
362+
*/
363+
public static List<RoleRight> possibleRights() {
364+
return POSSIBLE_RIGHTS;
365+
}
366+
345367
private List<MD> computePlainChildren() {
346368
return LazyLoader.computePlainChildren(this);
347369
}
@@ -362,6 +384,14 @@ private Map<URI, Module> computeModulesByURI() {
362384
return LazyLoader.computeModulesByURI(this);
363385
}
364386

387+
private Map<String, CommonModule> computeCommonModulesByName() {
388+
return LazyLoader.computeCommonModulesByName(this);
389+
}
390+
391+
private Map<MdoReference, MD> computeChildrenByMdoRef() {
392+
return LazyLoader.computeChildrenByMdoRef(this);
393+
}
394+
365395
private static Configuration createEmptyConfiguration() {
366396
var emptyString = "empty";
367397

@@ -371,4 +401,35 @@ private static Configuration createEmptyConfiguration() {
371401
.uuid(emptyString)
372402
.build();
373403
}
404+
405+
private static List<RoleRight> computePossibleRighs() {
406+
return List.of(
407+
RoleRight.ADMINISTRATION,
408+
RoleRight.DATA_ADMINISTRATION,
409+
RoleRight.UPDATE_DATA_BASE_CONFIGURATION,
410+
RoleRight.EXCLUSIVE_MODE,
411+
RoleRight.ACTIVE_USERS,
412+
RoleRight.EVENT_LOG,
413+
RoleRight.THIN_CLIENT,
414+
RoleRight.WEB_CLIENT,
415+
RoleRight.MOBILE_CLIENT,
416+
RoleRight.THICK_CLIENT,
417+
RoleRight.EXTERNAL_CONNECTION,
418+
RoleRight.AUTOMATION,
419+
RoleRight.TECHNICAL_SPECIALIST_MODE,
420+
RoleRight.COLLABORATION_SYSTEM_INFO_BASE_REGISTRATION,
421+
RoleRight.MAIN_WINDOW_MODE_EMBEDDED_WORKPLACE,
422+
RoleRight.MAIN_WINDOW_MODE_KIOSK,
423+
RoleRight.MAIN_WINDOW_MODE_NORMAL,
424+
RoleRight.MAIN_WINDOW_MODE_FULLSCREEN_WORKPLACE,
425+
RoleRight.MAIN_WINDOW_MODE_WORKPLACE,
426+
RoleRight.ANALYTICS_SYSTEM_CLIENT,
427+
RoleRight.EXCLUSIVE_MODE_TERMINATION_AT_SESSION_START,
428+
RoleRight.SAVE_USER_DATA,
429+
RoleRight.CONFIGURATION_EXTENSIONS_ADMINISTRATION,
430+
RoleRight.INTERACTIVE_OPEN_EXT_DATA_PROCESSORS,
431+
RoleRight.INTERACTIVE_OPEN_EXT_REPORTS,
432+
RoleRight.OUTPUT
433+
);
434+
}
374435
}

src/main/java/com/github/_1c_syntax/bsl/mdclasses/ConfigurationExtension.java

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@
7474
import com.github._1c_syntax.bsl.mdo.support.ConfigurationExtensionPurpose;
7575
import com.github._1c_syntax.bsl.mdo.support.MultiLanguageString;
7676
import com.github._1c_syntax.bsl.mdo.support.ObjectBelonging;
77+
import com.github._1c_syntax.bsl.mdo.support.RoleRight;
7778
import com.github._1c_syntax.bsl.mdo.support.ScriptVariant;
7879
import com.github._1c_syntax.bsl.mdo.support.UsePurposes;
7980
import com.github._1c_syntax.bsl.mdo.utils.LazyLoader;
@@ -247,6 +248,8 @@ public class ConfigurationExtension implements CF {
247248
Lazy<Map<URI, ModuleType>> modulesByType = new Lazy<>(this::computeModulesByType);
248249
Lazy<Map<URI, MD>> modulesByObject = new Lazy<>(this::computeModulesByObject);
249250
Lazy<Map<URI, Module>> modulesByURI = new Lazy<>(this::computeModulesByURI);
251+
Lazy<Map<String, CommonModule>> commonModulesByName = new Lazy<>(this::computeCommonModulesByName);
252+
Lazy<Map<MdoReference, MD>> childrenByMdoRef = new Lazy<>(this::computeChildrenByMdoRef);
250253

251254
/*
252255
* Свое
@@ -289,6 +292,23 @@ public Map<URI, Module> getModulesByURI() {
289292
return modulesByURI.getOrCompute();
290293
}
291294

295+
@Override
296+
public Map<String, CommonModule> getCommonModulesByName() {
297+
return commonModulesByName.getOrCompute();
298+
}
299+
300+
@Override
301+
public Map<MdoReference, MD> getChildrenByMdoRef() {
302+
return childrenByMdoRef.getOrCompute();
303+
}
304+
305+
/**
306+
* Возвращает перечень возможных прав доступа
307+
*/
308+
public static List<RoleRight> possibleRights() {
309+
return Configuration.possibleRights();
310+
}
311+
292312
private List<MD> computePlainChildren() {
293313
return LazyLoader.computePlainChildren(this);
294314
}
@@ -301,7 +321,6 @@ private Map<URI, MD> computeModulesByObject() {
301321
return LazyLoader.computeModulesByObject(this);
302322
}
303323

304-
305324
private List<Module> computeAllModules() {
306325
return LazyLoader.computeAllModules(this);
307326
}
@@ -310,4 +329,12 @@ private Map<URI, Module> computeModulesByURI() {
310329
return LazyLoader.computeModulesByURI(this);
311330
}
312331

332+
private Map<String, CommonModule> computeCommonModulesByName() {
333+
return LazyLoader.computeCommonModulesByName(this);
334+
}
335+
336+
private Map<MdoReference, MD> computeChildrenByMdoRef() {
337+
return LazyLoader.computeChildrenByMdoRef(this);
338+
}
339+
313340
}

0 commit comments

Comments
 (0)