comparison doc/design.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 2ab234484708
children
comparison
equal deleted inserted replaced
8132:603aa730b067 8133:7b6615fb37fc
1522 - name 1522 - name
1523 - description 1523 - description
1524 - klass (optional) 1524 - klass (optional)
1525 - properties (optional) 1525 - properties (optional)
1526 - check function (optional) 1526 - check function (optional)
1527 - filter function (optional)
1527 1528
1528 The klass may be unset, indicating that this permission is 1529 The klass may be unset, indicating that this permission is
1529 not locked to a particular hyperdb class. There may be 1530 not locked to a particular hyperdb class. There may be
1530 multiple Permissions for the same name for different 1531 multiple Permissions for the same name for different
1531 classes. 1532 classes.
1534 properties only. 1535 properties only.
1535 1536
1536 If check function is set, permission is granted only when 1537 If check function is set, permission is granted only when
1537 the function returns value interpreted as boolean true. 1538 the function returns value interpreted as boolean true.
1538 The function is called with arguments db, userid, itemid. 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 class Role: 1552 class Role:
1542 ''' Defines a Role with the attributes 1553 ''' Defines a Role with the attributes
1543 - name 1554 - name

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