@@ -1549,7 +1549,9 @@ shows the use of ``ctx``.
15491549 in the query checks above would look like::
15501550
15511551 def filter_query(db, userid, klass):
1552- return [{'filterspec': {'private_for': ['-1', userid]}}]
1552+ return [{'filterspec': {
1553+ 'private_for': ['-1', userid]
1554+ }}]
15531555
15541556 This would be called by the framework for all queries found when
15551557 displaying queries. It filters for all queries where the
@@ -1570,10 +1572,11 @@ shows the use of ``ctx``.
15701572 "or" condition, the user has access if either the ``private_for``
15711573 check passes *or* the user is the creator of the query.
15721574
1573- Now consider an example where we have a class ``organisation`` and the
1574- ``issue`` class has a ``Link`` to ``organisation`` as has the ``user``
1575- class. Users may only see issues that belong to their own
1576- ``organisation``. A ``check`` function for this would be::
1575+ Consider an example where we have a class structure where both the
1576+ ``issue`` class and the ``user`` class include a reference to an
1577+ ``organization`` class. Users are permitted to view only those
1578+ issues that are associated with their respective organizations. A
1579+ check function or this could look like::
15771580
15781581 def view_issue(db, userid, itemid):
15791582 user = db.user.getnode(userid)
@@ -1589,7 +1592,9 @@ shows the use of ``ctx``.
15891592 user = db.user.getnode(userid)
15901593 if not user.organisation:
15911594 return []
1592- return [{'filterspec': {'organisation': user.organisation}}]
1595+ return [{'filterspec': {
1596+ 'organisation': user.organisation
1597+ }}]
15931598
15941599 This filters for all issues where the organisation is the same as the
15951600 organisation of the user. Note how the filter fails early returning an
0 commit comments