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::
15241524 - klass (optional)
15251525 - properties (optional)
15261526 - check function (optional)
1527+ - filter function (optional)
15271528
15281529 The klass may be unset, indicating that this permission is
15291530 not locked to a particular hyperdb class. There may be
@@ -1536,6 +1537,16 @@ The security module defines::
15361537 If check function is set, permission is granted only when
15371538 the function returns value interpreted as boolean true.
15381539 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):
15391550 '''
15401551
15411552 class Role:
Original file line number Diff line number Diff line change @@ -1482,7 +1482,7 @@ When adding a new Permission, you need to:
148214824. check it in the appropriate hasPermission methods in your tracker's
14831483 extensions/detectors/interfaces.py modules
14841484
1485- The ``addPermission`` method takes a three optional parameters:
1485+ The ``addPermission`` method takes a four optional parameters:
14861486
14871487**check**
14881488 A function to be executed which returns boolean determining whether
@@ -1565,6 +1565,16 @@ shows the use of ``ctx``.
15651565
15661566 **Invalid properties for file: ['summary']
15671567
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+
15681578
15691579Example Scenarios
15701580~~~~~~~~~~~~~~~~~
You can’t perform that action at this time.
0 commit comments