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
Commits
fad89499
Commit
fad89499
authored
1 year ago
by
Podosochnyy Maxim
Browse files
Options
Downloads
Patches
Plain Diff
Правки
parent
55691c4a
No related branches found
No related tags found
1 merge request
!38
Исправлен алгоритм работы с коллекциями, клиентами и ролями
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
perxis/extensions/extension_setup.py
+20
-0
20 additions, 0 deletions
perxis/extensions/extension_setup.py
with
20 additions
and
0 deletions
perxis/extensions/extension_setup.py
+
20
−
0
View file @
fad89499
...
@@ -8,6 +8,7 @@ import typing
...
@@ -8,6 +8,7 @@ import typing
from
deepdiff
import
DeepDiff
from
deepdiff
import
DeepDiff
from
perxis.collections
import
collections_pb2_grpc
,
collections_pb2
from
perxis.collections
import
collections_pb2_grpc
,
collections_pb2
from
perxis.roles
import
roles_pb2_grpc
,
roles_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.clients
import
clients_pb2_grpc
,
clients_pb2
from
perxis.environments
import
environments_pb2_grpc
,
environments_pb2
from
perxis.environments
import
environments_pb2_grpc
,
environments_pb2
...
@@ -112,6 +113,25 @@ class ExtensionSetup:
...
@@ -112,6 +113,25 @@ class ExtensionSetup:
cloned_role
.
environments
[:]
=
role
.
environments
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
:
try
:
self
.
roles_service
.
Update
.
with_call
(
self
.
roles_service
.
Update
.
with_call
(
roles_pb2
.
UpdateRequest
(
roles_pb2
.
UpdateRequest
(
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment