Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
perxis-python
Manage
Activity
Members
Labels
Plan
Issues
3
Issue boards
Milestones
Wiki
Custom issue tracker
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
perxis
perxis-python
Merge requests
!38
Исправлен алгоритм работы с коллекциями, клиентами и ролями
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Исправлен алгоритм работы с коллекциями, клиентами и ролями
feature/AUTO-1294-change-collections-algoritm-in-setup
into
master
Overview
0
Commits
6
Pipelines
0
Changes
5
Merged
Podosochnyy Maxim
requested to merge
feature/AUTO-1294-change-collections-algoritm-in-setup
into
master
1 year ago
Overview
0
Commits
6
Pipelines
0
Changes
1
Expand
https://tracker.yandex.ru/AUTO-1294
0
0
Merge request reports
Viewing commit
fad89499
Prev
Next
Show latest version
1 file
+
20
−
0
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
fad89499
Правки
· fad89499
Podosochnyy Maxim
authored
1 year ago
perxis/extensions/extension_setup.py
+
20
−
0
Options
@@ -8,6 +8,7 @@ import typing
from
deepdiff
import
DeepDiff
from
perxis.collections
import
collections_pb2_grpc
,
collections_pb2
from
perxis.roles
import
roles_pb2_grpc
,
roles_pb2
from
perxis.common
import
common_pb2
from
perxis.clients
import
clients_pb2_grpc
,
clients_pb2
from
perxis.environments
import
environments_pb2_grpc
,
environments_pb2
@@ -112,6 +113,25 @@ class ExtensionSetup:
cloned_role
.
environments
[:]
=
role
.
environments
# Произвести мерж правил доступа
for
exist_rule
in
role
.
rules
:
was_found
=
False
for
local_rule
in
cloned_role
.
rules
:
if
local_rule
.
collection_id
==
exist_rule
.
collection_id
:
was_found
=
True
local_rule
.
actions
[:]
=
list
(
set
(
local_rule
.
actions
+
exist_rule
.
actions
))
break
# Если правило для коллекций не было найдено - его нужно добавить
if
not
was_found
:
cloned_role
.
rules
.
append
(
common_pb2
.
Rule
(
collection_id
=
exist_rule
.
collection_id
,
actions
=
exist_rule
.
actions
))
try
:
self
.
roles_service
.
Update
.
with_call
(
roles_pb2
.
UpdateRequest
(
Loading