# HG changeset patch # User John Rouillard # Date 1737332957 18000 # Node ID 302c797756e6018f37bfc1d4eda21b3b0ddfdaf2 # Parent 5d1f833801f9a00543c2cdb78ed022528174d705 fix: issue2550962. remove assert in Role::hasPermission issue2550962 - Check uses of assert in roundup code. An assert was used to make sure that a classname always accompoanied an itemid in hasPermission. The Security::hasPErmission has an if clause that does the same check and raises a ValueError. Remove asserts because they ae removed when running python in optimized mode. diff -r 5d1f833801f9 -r 302c797756e6 roundup/security.py --- a/roundup/security.py Sun Jan 19 11:42:40 2025 -0500 +++ b/roundup/security.py Sun Jan 19 19:29:17 2025 -0500 @@ -267,7 +267,9 @@ def hasPermission (self, db, perm, uid, classname, property, itemid, chk): # if itemid is given a classname must, too, checked in caller - assert not itemid or classname + if itemid and classname is None: + raise ValueError('classname must accompany itemid') + perms = self._permissions if perm not in perms: return False