comparison doc/reference.txt @ 8133:7b6615fb37fc permission-performance

Add documentation for the filter function
author Ralf Schlatterbeck <rsc@runtux.com>
date Wed, 23 Oct 2024 14:49:45 +0200
parents 394f72021dad
children 67a0fc4f9934
comparison
equal deleted inserted replaced
8132:603aa730b067 8133:7b6615fb37fc
1480 "``roundup-admin security``") 1480 "``roundup-admin security``")
1481 3. check it in the relevant HTML interface templates 1481 3. check it in the relevant HTML interface templates
1482 4. check it in the appropriate hasPermission methods in your tracker's 1482 4. check it in the appropriate hasPermission methods in your tracker's
1483 extensions/detectors/interfaces.py modules 1483 extensions/detectors/interfaces.py modules
1484 1484
1485 The ``addPermission`` method takes a three optional parameters: 1485 The ``addPermission`` method takes a four optional parameters:
1486 1486
1487 **check** 1487 **check**
1488 A function to be executed which returns boolean determining whether 1488 A function to be executed which returns boolean determining whether
1489 the Permission is allowed. If it returns True, the permission is 1489 the Permission is allowed. If it returns True, the permission is
1490 allowed, if it returns False the permission is denied. The function 1490 allowed, if it returns False the permission is denied. The function
1562 1562
1563 Allowed to see content of object regardless of spam status 1563 Allowed to see content of object regardless of spam status
1564 (View for "file": ('content', 'summary') only) 1564 (View for "file": ('content', 'summary') only)
1565 1565
1566 **Invalid properties for file: ['summary'] 1566 **Invalid properties for file: ['summary']
1567
1568 **filter
1569 A function that complements a check function: It is used when
1570 searching for viewable items. The filter function allows to filter in
1571 SQL (for an SQL backend) rather than calling the check function for
1572 each item after a query. It must return a list of dictionaries
1573 containing parameters for the hyperdb.Class.filter method. An empty
1574 list indicates no access. The signature of the filter function is::
1575
1576 def filter(db, userid, klass):
1567 1577
1568 1578
1569 Example Scenarios 1579 Example Scenarios
1570 ~~~~~~~~~~~~~~~~~ 1580 ~~~~~~~~~~~~~~~~~
1571 1581

Roundup Issue Tracker: http://roundup-tracker.org/