Mercurial > p > roundup > code
comparison roundup/hyperdb.py @ 8136:5a2b9435a04d permission-performance
Make permission filter functions configurable
For debugging and performance measurements it makes sense to allow
turning permission filter functions off.
| author | Ralf Schlatterbeck <rsc@runtux.com> |
|---|---|
| date | Wed, 23 Oct 2024 17:46:05 +0200 |
| parents | aa5ae3f84889 |
| children | de58ff07890e |
comparison
equal
deleted
inserted
replaced
| 8135:aa5ae3f84889 | 8136:5a2b9435a04d |
|---|---|
| 1818 retired, exact_match_spec, limit, offset) | 1818 retired, exact_match_spec, limit, offset) |
| 1819 check = sec.hasPermission | 1819 check = sec.hasPermission |
| 1820 if check(permission, userid, cn, only_no_check = True): | 1820 if check(permission, userid, cn, only_no_check = True): |
| 1821 allowed = item_ids | 1821 allowed = item_ids |
| 1822 else: | 1822 else: |
| 1823 debug = self.db.config.RDBMS_DEBUG_FILTER | |
| 1823 # Note that is_filterable returns True if no permissions are | 1824 # Note that is_filterable returns True if no permissions are |
| 1824 # found. This makes it fail early (with an empty allowed list) | 1825 # found. This makes it fail early (with an empty allowed list) |
| 1825 # instead of running through all ids with an empty | 1826 # instead of running through all ids with an empty |
| 1826 # permission list. | 1827 # permission list. |
| 1827 if sec.is_filterable(permission, userid, cn): | 1828 if not debug and sec.is_filterable(permission, userid, cn): |
| 1828 new_ids = set(item_ids) | 1829 new_ids = set(item_ids) |
| 1829 confirmed = set() | 1830 confirmed = set() |
| 1830 for perm in sec.filter_iter(permission, userid, cn): | 1831 for perm in sec.filter_iter(permission, userid, cn): |
| 1831 fargs = perm.filter(self.db, userid, self) | 1832 fargs = perm.filter(self.db, userid, self) |
| 1832 for farg in fargs: | 1833 for farg in fargs: |
