X-Git-Url: https://osm.etsi.org/gitweb/?a=blobdiff_plain;f=osm_nbi%2Fadmin_topics.py;h=6e9f078ccdbf8d0f10f291392c435afb672ba212;hb=bce146004ea0e10da51ab7a98b169d812a8afe03;hp=998c12f6cbac9bbe39bda2f159867b0dc7074f7a;hpb=3ef02756b574db3cbdd9cc80198d1e2dc46c3f85;p=osm%2FNBI.git diff --git a/osm_nbi/admin_topics.py b/osm_nbi/admin_topics.py index 998c12f..6e9f078 100644 --- a/osm_nbi/admin_topics.py +++ b/osm_nbi/admin_topics.py @@ -1078,9 +1078,9 @@ class RoleTopicAuth(BaseTopic): if role_def[-1] == ":": raise ValidationError("Operation cannot end with ':'") - role_def_matches = [op for op in operations if op.startswith(role_def)] + match = next((op for op in operations if op == role_def or op.startswith(role_def + ":")), None) - if len(role_def_matches) == 0: + if not match: raise ValidationError("Invalid permission '{}'".format(role_def)) def _validate_input_new(self, input, force=False):