File tree Expand file tree Collapse file tree 2 files changed +22
-1
lines changed Expand file tree Collapse file tree 2 files changed +22
-1
lines changed Original file line number Diff line number Diff line change @@ -1524,6 +1524,7 @@ The security module defines::
1524
1524
- klass (optional)
1525
1525
- properties (optional)
1526
1526
- check function (optional)
1527
+ - filter function (optional)
1527
1528
1528
1529
The klass may be unset, indicating that this permission is
1529
1530
not locked to a particular hyperdb class. There may be
@@ -1536,6 +1537,16 @@ The security module defines::
1536
1537
If check function is set, permission is granted only when
1537
1538
the function returns value interpreted as boolean true.
1538
1539
The function is called with arguments db, userid, itemid.
1540
+
1541
+ A filter function complements a check function: It is used
1542
+ when searching for viewable items. The filter function
1543
+ allows to filter in SQL rather than calling the check
1544
+ function for each item after a query. It must return a list
1545
+ of dictionaries containing parameters for the hyperdb.Class.filter
1546
+ method. An empty list indicates no access. The signature of
1547
+ the filter function is::
1548
+
1549
+ def filter(db, userid, klass):
1539
1550
'''
1540
1551
1541
1552
class Role:
Original file line number Diff line number Diff line change @@ -1482,7 +1482,7 @@ When adding a new Permission, you need to:
1482
1482
4. check it in the appropriate hasPermission methods in your tracker's
1483
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
1487
**check**
1488
1488
A function to be executed which returns boolean determining whether
@@ -1565,6 +1565,16 @@ shows the use of ``ctx``.
1565
1565
1566
1566
**Invalid properties for file: ['summary']
1567
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):
1577
+
1568
1578
1569
1579
Example Scenarios
1570
1580
~~~~~~~~~~~~~~~~~
You can’t perform that action at this time.
0 commit comments