projects
/
osm
/
NBI.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
enhanced role permission validation
[osm/NBI.git]
/
osm_nbi
/
admin_topics.py
diff --git
a/osm_nbi/admin_topics.py
b/osm_nbi/admin_topics.py
index
998c12f
..
6e9f078
100644
(file)
--- 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 ':'")
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):
raise ValidationError("Invalid permission '{}'".format(role_def))
def _validate_input_new(self, input, force=False):