Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 9 additions & 15 deletions sros2/api/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -334,20 +334,20 @@ def create_permission_file(path, name, domain_id, permissions_dict):
permission_str += """\
<%s>
<partitions>
<partition>%s</partition>
<partition></partition>
</partitions>
<topics>
<topic>%s</topic>
</topics>
</%s>
""" % (tag, 'rt', topic_name, tag)
""" % (tag, 'rt/' + topic_name, tag)
# TODO(mikaelarguedas) remove this hardcoded handling for default parameter topics
# TODO(mikaelarguedas) remove the need for empty partition

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this todo can be removed, right?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed, removed in 9a622e6

# (required for Connext at startup),
# see https://github.com/ros2/sros2/issues/32#issuecomment-367388140
service_partitions_prefix = {
'Request': ['', 'rq/%s' % name],
'Reply': ['', 'rr/%s' % name],
service_topic_prefixes = {
'Request': 'rq/%s/' % name,
'Reply': 'rr/%s/' % name,
}
default_parameter_topics = [
'get_parameters',
Expand All @@ -356,33 +356,27 @@ def create_permission_file(path, name, domain_id, permissions_dict):
'list_parameters',
'describe_parameters',
]
for key in service_partitions_prefix.keys():
for key, value in service_topic_prefixes.items():
if key == 'Request':
pubsubtag = 'publish'
else:
pubsubtag = 'subscribe'
tag = 'partition'
partition_string = \
'<%s>' % tag + \
('</%s><%s>' % (tag, tag)).join(
[partition for partition in service_partitions_prefix[key]]) + \
'</%s>' % tag
tag = 'topic'
topics_string = \
'<%s>' % tag + \
('</%s><%s>' % (tag, tag)).join(
[(topic + key) for topic in default_parameter_topics]) + \
[(value + topic + key) for topic in default_parameter_topics]) + \
'</%s>' % tag
permission_str += """\
<%s>
<partitions>
%s
<partition></partition>
</partitions>
<topics>
%s
</topics>
</%s>
""" % (pubsubtag, partition_string, topics_string, pubsubtag)
""" % (pubsubtag, topics_string, pubsubtag)

else:
# no policy found: allow everything!
Expand Down