Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
perxis-python
Manage
Activity
Members
Plan
Custom issue tracker
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package registry
Operate
Terraform modules
Analyze
Contributor analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
perxis
perxis-python
Commits
fad89499
Commit
fad89499
authored
2 years ago
by
Podosochnyy Maxim
Browse files
Options
Downloads
Patches
Plain Diff
Правки
parent
55691c4a
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Show 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