Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
BaSys4Forestry - Projektmanagement
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Container registry
Model registry
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Lehrstuhl für Informations- und Automatisierungssysteme
BaSys4Forestry - Projektmanagement
Commits
0bcd7d27
Commit
0bcd7d27
authored
Oct 9, 2023
by
Ahmed Osman
Browse files
Options
Downloads
Patches
Plain Diff
fix update security
parent
6c758a8e
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
demos/demo2/broker_api.py
+3
-3
3 additions, 3 deletions
demos/demo2/broker_api.py
demos/demo2/demo2_forestmanager_waldbesitzer.py
+8
-2
8 additions, 2 deletions
demos/demo2/demo2_forestmanager_waldbesitzer.py
with
11 additions
and
5 deletions
demos/demo2/broker_api.py
+
3
−
3
View file @
0bcd7d27
...
@@ -50,7 +50,7 @@ class S3IBServer:
...
@@ -50,7 +50,7 @@ class S3IBServer:
self
.
serializer
=
AASToJsonEncoder
()
self
.
serializer
=
AASToJsonEncoder
()
self
.
deserializer
=
AASFromJsonDecoder
()
self
.
deserializer
=
AASFromJsonDecoder
()
self
.
opa
=
opa_api
.
Opa
(
opa_server_url
)
self
.
opa
=
opa_api
.
Opa
(
opa_server_url
)
self
.
security_
id
=
base64
.
urlsafe_b64encode
(
security_id
.
encode
()).
decode
()
self
.
security_
path
=
f
"
/aas/submodels/
{
base64
.
urlsafe_b64encode
(
security_id
.
encode
()).
decode
()
}
/submodel
"
self
.
security_enabled
=
security_enabled
self
.
security_enabled
=
security_enabled
self
.
callables
:
dict
[
str
,
Callable
]
=
{}
self
.
callables
:
dict
[
str
,
Callable
]
=
{}
...
@@ -58,7 +58,7 @@ class S3IBServer:
...
@@ -58,7 +58,7 @@ class S3IBServer:
self
.
_update_security
()
self
.
_update_security
()
def
_update_security
(
self
):
def
_update_security
(
self
):
security_sm
=
self
.
provider
.
getValue
(
f
"
/aas/submodels/
{
self
.
security_
id
}
/submodel
"
)
security_sm
=
self
.
provider
.
getValue
(
self
.
security_
path
)
data
=
security
.
get_dic_from_security_submodel
(
security_sm
)
data
=
security
.
get_dic_from_security_submodel
(
security_sm
)
self
.
opa
.
update_data
(
data
,
"
api
"
)
self
.
opa
.
update_data
(
data
,
"
api
"
)
...
@@ -150,7 +150,7 @@ class S3IBServer:
...
@@ -150,7 +150,7 @@ class S3IBServer:
self
.
broker
.
publish_event
(
json
.
dumps
(
evt_msg
.
base_msg
),
event
.
message_topic
)
self
.
broker
.
publish_event
(
json
.
dumps
(
evt_msg
.
base_msg
),
event
.
message_topic
)
# update opa server if security overwrittem
# update opa server if security overwrittem
if
self
.
security_enabled
and
path
.
startswith
(
self
.
security_
id
):
if
self
.
security_enabled
and
path
.
startswith
(
self
.
security_
path
):
self
.
_update_security
()
self
.
_update_security
()
...
...
...
...
This diff is collapsed.
Click to expand it.
demos/demo2/demo2_forestmanager_waldbesitzer.py
+
8
−
2
View file @
0bcd7d27
...
@@ -55,7 +55,8 @@ async def main():
...
@@ -55,7 +55,8 @@ async def main():
resource_path
=
"
aas
"
resource_path
=
"
aas
"
permission_receiver
=
forestmanager_hmi_id
permission_receiver
=
forestmanager_hmi_id
security_sm
:
model
.
Submodel
=
await
client
.
getValue
(
dzwald_id
,
dzwald_endpoint
,
security_sm
:
model
.
Submodel
=
await
client
.
getValue
(
dzwald_id
,
dzwald_endpoint
,
f
"
/aas/submodels/
{
helpers
.
encode_id
(
'
https
:
//
www
.
company
.
com
/
security
'
)
}
/submodel
"
)
f
"
/aas/submodels/
{
helpers
.
encode_id
(
'
https
:
//
www
.
company
.
com
/
security
'
)
}
/submodel
"
)
access_control
:
model
.
SubmodelElementList
=
security_sm
.
get_referable
(
"
AccessControl
"
)
access_control
:
model
.
SubmodelElementList
=
security_sm
.
get_referable
(
"
AccessControl
"
)
...
@@ -77,6 +78,11 @@ async def main():
...
@@ -77,6 +78,11 @@ async def main():
rules
.
remove_referable
(
rule
.
id_short
)
rules
.
remove_referable
(
rule
.
id_short
)
utils
.
add_items_to_se_list
(
rules
,
new_rules
)
utils
.
add_items_to_se_list
(
rules
,
new_rules
)
await
client
.
setValue
(
dzwald_id
,
dzwald_endpoint
,
f
"
/aas/submodels/
{
helpers
.
encode_id
(
'
https
:
//
www
.
company
.
com
/
security
'
)
}
/submodel
"
,
security_sm
)
await
client
.
sendUserMessage
(
forestmanager_hmi_id
,
"
s3ibs://
"
+
forestmanager_hmi_id
,
"
Authorized
"
,
"
Authorized
"
)
await
client
.
sendUserMessage
(
forestmanager_hmi_id
,
"
s3ibs://
"
+
forestmanager_hmi_id
,
"
Authorized
"
,
"
Authorized
"
)
...
...
...
...
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
sign in
to comment