comparison doc/reference.txt @ 7858:376f70513242

doc(lint): address more vale complaints. Also restructured a couple of section to clean them up or alphabetize the section (e.g. for properties or url parameters). Also fixed up list of url's to include a home url and make items 1-6 in the explantion match items 1-6 in the example url's. Hopefully this makes things clearer.
author John Rouillard <rouilj@ieee.org>
date Wed, 03 Apr 2024 16:53:13 -0400
parents 047c02dfa267
children 90abf3721fcc
comparison
equal deleted inserted replaced
7857:d26eb77e01d8 7858:376f70513242
1649 Anonymous users access to the email interface. When granted to the 1649 Anonymous users access to the email interface. When granted to the
1650 Anonymous user, they will be automatically registered by the email 1650 Anonymous user, they will be automatically registered by the email
1651 interface (see also the ``new_email_user_roles`` configuration option). 1651 interface (see also the ``new_email_user_roles`` configuration option).
1652 1652
1653 Web Access 1653 Web Access
1654 If defined, the user may use the web interface. This is usually 1654 If defined, the user may use the web interface. This is
1655 assigned to the Anonymous role as well to allow authorized users to 1655 assigned to the Anonymous role to allow authorized users to
1656 access the form based login. If some other authorization mode (basic 1656 access the form based login. If your tracker uses some other
1657 auth, SSO, etc.) is used Web Access can be removed from the 1657 authorization mode (basic auth, Single Sign On (SSO), etc.) Web
1658 Anonymous user. 1658 Access can be removed from the Anonymous user.
1659 1659
1660 Web Roles 1660 Web Roles
1661 Controls user access to editing the "roles" property of the "user" class. 1661 Controls user access to editing the "roles" property of the "user" class.
1662 TODO: deprecate in favour of a property-based control. 1662 TODO: deprecate in favour of a property-based control.
1663 1663
1666 roles have these by default in the classic tracker. See the 1666 roles have these by default in the classic tracker. See the
1667 `directions in the rest interface documentation`_ and the 1667 `directions in the rest interface documentation`_ and the
1668 `xmlrpc interface documentation`_. 1668 `xmlrpc interface documentation`_.
1669 1669
1670 Register 1670 Register
1671 This is assigned to the anonymous user and allows automatic user 1671 This enables automatic user registration by email or web. It is
1672 registration by email or web. 1672 assigned to the anonymous user.
1673 1673
1674 These are hooked into the default Roles: 1674 These are assigned into the default Roles:
1675 1675
1676 - Admin (Create, Edit, Retire, Restore, Search, View for everything; Web Roles) 1676 - Admin (Create, Edit, Retire, Restore, Search, View for everything; Web Roles)
1677 - User (Web Access; Email Access) 1677 - User (Web Access; Email Access)
1678 - Anonymous (Web Access) 1678 - Anonymous (Web Access)
1679 1679
1686 - Create, Edit and View issue, file, msg, query, keyword 1686 - Create, Edit and View issue, file, msg, query, keyword
1687 - View priority, status 1687 - View priority, status
1688 - View user 1688 - View user
1689 - Edit their own user record 1689 - Edit their own user record
1690 1690
1691 And the "Anonymous" Role is defined as: 1691 And the "Anonymous" Role has the following permissions:
1692 1692
1693 - Web interface access 1693 - Web interface access
1694 - Register user (for registration) 1694 - Register user (for registration)
1695 - View issue, file, msg, query, keyword, priority, status 1695 - View issue, file, msg, query, keyword, priority, status
1696 1696
1817 cause baffling permission issues. 1817 cause baffling permission issues.
1818 1818
1819 Automatic Permission Checks 1819 Automatic Permission Checks
1820 --------------------------- 1820 ---------------------------
1821 1821
1822 Permissions are automatically checked when information is rendered 1822 Permissions are automatically checked when rendering information
1823 through the web. This includes: 1823 through the web. This includes:
1824 1824
1825 1. View checks for properties when being rendered via the ``plain()`` or 1825 1. View checks for properties when rendered via the ``plain()`` or
1826 similar methods. If the check fails, the text "[hidden]" will be 1826 similar methods. If the check fails, the text "[hidden]" is
1827 displayed. 1827 displayed.
1828 2. Edit checks for properties when the edit field is being rendered via 1828 2. Edit checks for properties when the edit field is rendered via
1829 the ``field()`` or similar methods. If the check fails, the property 1829 the ``field()`` or similar methods. If the check fails, the property
1830 will be rendered via the ``plain()`` method (see point 1. for subsequent 1830 is rendered via the ``plain()`` method (see point 1. for subsequent
1831 checking performed) 1831 checking performed)
1832 3. View checks are performed in index pages for each item being displayed 1832 3. View checks are performed in index pages for each item being displayed
1833 such that if the user does not have permission, the row is not rendered. 1833 such that if the user does not have permission, the row is not rendered.
1834 4. View checks are performed at the top of item pages for the Item being 1834 4. View checks are performed at the top of item pages for the Item being
1835 displayed. If the user does not have permission, the text "You are not 1835 displayed. If the user does not have permission, the text "You are not
1836 allowed to view this page." will be displayed. 1836 allowed to view this page." is displayed.
1837 5. View checks are performed at the top of index pages for the Class being 1837 5. View checks are performed at the top of index pages for the Class being
1838 displayed. If the user does not have permission, the text "You are not 1838 displayed. If the user does not have permission, the text "You are not
1839 allowed to view this page." will be displayed. 1839 allowed to view this page." is displayed.
1840 1840
1841 1841
1842 New User Roles 1842 New User Roles
1843 -------------- 1843 --------------
1844 1844
1861 1861
1862 You may use the ``roundup-admin`` "``security``" command to display the 1862 You may use the ``roundup-admin`` "``security``" command to display the
1863 current Role and Permission configuration in your tracker. 1863 current Role and Permission configuration in your tracker.
1864 1864
1865 1865
1866 Adding a new Permission 1866 Adding a New Permission
1867 ~~~~~~~~~~~~~~~~~~~~~~~ 1867 ~~~~~~~~~~~~~~~~~~~~~~~
1868 1868
1869 When adding a new Permission, you will need to: 1869 When adding a new Permission, you need to:
1870 1870
1871 1. add it to your tracker's ``schema.py`` so it is created, using 1871 1. create it in your tracker's ``schema.py`` using
1872 ``security.addPermission``, for example:: 1872 ``security.addPermission``. For example::
1873 1873
1874 db.security.addPermission(name="View", klass='frozzle', 1874 db.security.addPermission(name="View", klass='frozzle',
1875 description="User is allowed to access frozzles") 1875 description="User is allowed to access frozzles")
1876 1876
1877 will set up a new "View" permission on the Class "frozzle". 1877 will set up a new "View" permission on the Class "frozzle".
1878 2. enable it for the Roles that should have it (verify with 1878 2. enable it for the Roles that should have it (verify with
1879 "``roundup-admin security``") 1879 "``roundup-admin security``")
1880 3. add it to the relevant HTML interface templates 1880 3. check it in the relevant HTML interface templates
1881 4. add it to the appropriate xxxPermission methods on in your tracker 1881 4. check it in the appropriate hasPermission methods in your tracker's
1882 interfaces module 1882 extensions/detectors/interfaces.py modules
1883 1883
1884 The ``addPermission`` method takes a few optional parameters: 1884 The ``addPermission`` method takes a three optional parameters:
1885 1885
1886 **check**
1887 A function to be executed which returns boolean determining whether
1888 the Permission is allowed. If it returns True, the permission is
1889 allowed, if it returns False the permission is denied. The function
1890 can have one of two signatures::
1891
1892 check(db, userid, itemid)
1893
1894 or::
1895
1896 check(db, userid, itemid, **ctx)
1897
1898 where ``db`` is a handle on the open database, ``userid`` is
1899 the user attempting access and ``itemid`` is the specific item being
1900 accessed. If the second form is used the ``ctx`` dictionary is
1901 defined with the following values::
1902
1903 ctx['property'] the name of the property being checked or None if
1904 it's a class check.
1905
1906 ctx['classname'] the name of the class that is being checked
1907 (issue, query ....).
1908
1909 ctx['permission'] the name of the permission (e.g. View, Edit...).
1910
1911 The second form is preferred as it makes it easier to implement more
1912 complex permission schemes. An `example in upgrading.html
1913 <upgrading.html#enhancement-to-check-command-for-permissions>`_
1914 shows the use of ``ctx``.
1886 **properties** 1915 **properties**
1887 A sequence of property names that are the only properties to apply the 1916 A sequence of property names that are the only properties to apply the
1888 new Permission to (eg. ``... klass='user', properties=('name', 1917 new Permission to (eg. ``... klass='user', properties=('name',
1889 'email') ...``) 1918 'email') ...``)
1890 **props_only** 1919 **props_only**
1892 in Roundup 1.6. 1921 in Roundup 1.6.
1893 A permission defined using: 1922 A permission defined using:
1894 1923
1895 ``properties=('list', 'of', 'property', 'names')`` 1924 ``properties=('list', 'of', 'property', 'names')``
1896 1925
1897 is used to determine access for things other than just those 1926 determines access for things other than just those
1898 properties. For example a check for View permission on the issue 1927 properties. For example a check for View permission on the
1899 class or an issue item can use any View permission for the issue 1928 issue class or an issue item can use any View permission for
1900 class even if that permission has a property list. This can be 1929 the issue class even if that permission has a property
1901 confusing and surprising as you would think that a permission 1930 list. This makes sense if you understand that a user can't
1902 including properties would be used only for determining the 1931 access the properties of a class if they can't access the
1903 access permission for those properties. 1932 class. The ability to access class properties implies class
1933 access.
1934
1935 This eliminates the need to create a duplicate View permission
1936 without properties to allow access to the View properties
1937 permission. Even though it makes sense, it can be confusing and
1938 surprising.
1939
1940 You would think that a permission including properties would be
1941 used only for determining the access permission when checking
1942 properties. But that is not the case.
1943
1944 Setting ``props_only=True`` will prevent the permission
1945 from being used unless the check include properties.
1946
1947 If you use a lot of permissions with property checks, it can be
1948 difficult to change all of them. Calling the function:
1949
1950 db.security.set_props_only_default(True)
1951
1952 at the top of ``schema.py`` will make every permission creation
1953 behave as though props_only is True. Note that you may
1954 need to add new View permissions without properties to allow
1955 property only checks to take effect.
1904 1956
1905 ``roundup-admin security`` will report invalid properties for the 1957 ``roundup-admin security`` will report invalid properties for the
1906 class. For example a permission with an invalid summary property is 1958 class. For example a permission with an invalid summary property is
1907 presented as:: 1959 presented as::
1908 1960
1909 Allowed to see content of object regardless of spam status 1961 Allowed to see content of object regardless of spam status
1910 (View for "file": ('content', 'summary') only) 1962 (View for "file": ('content', 'summary') only)
1911 1963
1912 **Invalid properties for file: ['summary'] 1964 **Invalid properties for file: ['summary']
1913 1965
1914 Setting ``props_only=True`` will make the permission valid only for
1915 those properties.
1916
1917 If you use a lot of permissions with property checks, it can be
1918 difficult to change all of them. Calling the function:
1919
1920 db.security.set_props_only_default(True)
1921
1922 at the top of ``schema.py`` will make every permission creation
1923 behave as though props_only was set to True. It is expected that the
1924 default of True will become the default in a future Roundup release.
1925 **check**
1926 A function to be executed which returns boolean determining whether
1927 the Permission is allowed. If it returns True, the permission is
1928 allowed, if it returns False the permission is denied. The function
1929 can have one of two signatures::
1930
1931 check(db, userid, itemid)
1932
1933 or::
1934
1935 check(db, userid, itemid, **ctx)
1936
1937 where ``db`` is a handle on the open database, ``userid`` is
1938 the user attempting access and ``itemid`` is the specific item being
1939 accessed. If the second form is used the ``ctx`` dictionary is
1940 defined with the following values::
1941
1942 ctx['property'] the name of the property being checked or None if
1943 it's a class check.
1944
1945 ctx['classname'] the name of the class that is being checked
1946 (issue, query ....).
1947
1948 ctx['permission'] the name of the permission (e.g. View, Edit...).
1949
1950 The second form is preferred as it makes it easier to implement more
1951 complex permission schemes. An `example in upgrading.html
1952 <upgrading.html#enhancement-to-check-command-for-permissions>`_
1953 shows the use of ``ctx``.
1954 1966
1955 Example Scenarios 1967 Example Scenarios
1956 ~~~~~~~~~~~~~~~~~ 1968 ~~~~~~~~~~~~~~~~~
1957 1969
1958 See the `examples <customizing.html#examples>`_ section for longer 1970 See the `examples <customizing.html#examples>`_ section for longer
1972 **automatic registration of users in the e-mail gateway** 1984 **automatic registration of users in the e-mail gateway**
1973 By giving the "anonymous" user the ("Register", "user") Permission, any 1985 By giving the "anonymous" user the ("Register", "user") Permission, any
1974 unidentified user will automatically be registered with the tracker 1986 unidentified user will automatically be registered with the tracker
1975 (with no password, so they won't be able to log in through 1987 (with no password, so they won't be able to log in through
1976 the web until an admin sets their password). By default new Roundup 1988 the web until an admin sets their password). By default new Roundup
1977 trackers don't allow this as it opens them up to spam. It may be enabled 1989 trackers don't enable "Email Access" for "anonymous" as it opens
1990 them up to spam. It may be enabled
1978 by uncommenting the appropriate addPermissionToRole in your tracker's 1991 by uncommenting the appropriate addPermissionToRole in your tracker's
1979 ``schema.py`` file. The new user is given the Roles list defined in the 1992 ``schema.py`` file. The new user is given the Roles list defined in the
1980 "new_email_user_roles" config variable. 1993 "new_email_user_roles" config variable.
1981 1994
1982 **only developers may be assigned issues** 1995 **only developers may be assigned issues**
1991 **only managers may sign off issues as complete** 2004 **only managers may sign off issues as complete**
1992 Create a new Permission called "Closer" for the "issue" class. Create a 2005 Create a new Permission called "Closer" for the "issue" class. Create a
1993 new Role "Manager" which has that Permission, and assign that to the 2006 new Role "Manager" which has that Permission, and assign that to the
1994 appropriate users. In your web interface, only display the "resolved" 2007 appropriate users. In your web interface, only display the "resolved"
1995 issue state option when the user has the "Closer" Permissions. Enforce 2008 issue state option when the user has the "Closer" Permissions. Enforce
1996 the Permission with an auditor. This is very similar to the previous 2009 the Permission with an auditor. This is similar to the previous
1997 example, except that the web interface check would look like:: 2010 example, except that the web interface check would look like::
1998 2011
1999 <option tal:condition="python:request.user.hasPermission('Closer')" 2012 <option tal:condition="python:request.user.hasPermission('Closer')"
2000 value="resolved">Resolved</option> 2013 value="resolved">Resolved</option>
2001 2014
2022 .. contents:: 2035 .. contents::
2023 :local: 2036 :local:
2024 2037
2025 The web interface is provided by the ``roundup.cgi.client`` module and 2038 The web interface is provided by the ``roundup.cgi.client`` module and
2026 is used by ``roundup.cgi``, ``roundup-server`` and ``ZRoundup`` 2039 is used by ``roundup.cgi``, ``roundup-server`` and ``ZRoundup``
2027 (``ZRoundup`` is broken, until further notice). In all cases, we 2040 (``ZRoundup`` is broken, until further notice). In all cases, Roundup
2028 determine which tracker is being accessed (the first part of the URL 2041 determines which tracker is accessed (the first part of the URL
2029 path inside the scope of the CGI handler) and pass control on to the 2042 path inside the scope of the CGI handler) and pass control on to the
2030 ``roundup.cgi.client.Client`` class - which handles the rest of the 2043 ``roundup.cgi.client.Client`` class - which handles the rest of the
2031 access through its ``main()`` method. This means that you can do pretty 2044 access through its ``main()`` method. This means that you can do pretty
2032 much anything you want as a web interface to your tracker. 2045 much anything you want as a web interface to your tracker.
2033 2046
2039 If you choose to change the `tracker schema`_ you will need to ensure 2052 If you choose to change the `tracker schema`_ you will need to ensure
2040 the web interface knows about it: 2053 the web interface knows about it:
2041 2054
2042 1. Index, item and search pages for the relevant classes may need to 2055 1. Index, item and search pages for the relevant classes may need to
2043 have properties added or removed, 2056 have properties added or removed,
2044 2. The "page" template may require links to be changed, as might the 2057 2. The "page" template may require changing links, as might the
2045 "home" page's content arguments. 2058 "home" page's content arguments.
2046 2059
2047 2060
2048 How requests are processed 2061 How requests are processed
2049 -------------------------- 2062 --------------------------
2081 2094
2082 1. ``/`` 2095 1. ``/``
2083 2. ``/index`` 2096 2. ``/index``
2084 3. ``/home`` 2097 3. ``/home``
2085 2098
2086 The following prefix is used to access static resources: 2099 The following prefix accesses static resources:
2087 2100
2088 4. ``/@@file/`` 2101 4. ``/@@file/``
2089 2102
2090 Two additional url's are used for the API's. 2103 Two url's are used for the API's.
2091 The `REST api`_ is accessed via: 2104 The `REST api`_ is accessed via:
2092 2105
2093 5. ``/rest/`` 2106 5. ``/rest/``
2094 2107
2095 .. _`REST api`: rest.html 2108 .. _`REST api`: rest.html
2104 Each class receives two URLs - one for the class itself and another 2117 Each class receives two URLs - one for the class itself and another
2105 for specific items of that class. Example for class URL: 2118 for specific items of that class. Example for class URL:
2106 2119
2107 7. ``/issue`` 2120 7. ``/issue``
2108 2121
2109 This is usually used to show listings of class items. The URL for 2122 Shows a listings of class items, usually in a table. The URL for
2110 for specific object of issue class with id 1 will look like: 2123 for specific object of issue class with id 1 will look like:
2111 2124
2112 8. ``/issue1`` 2125 8. ``/issue1``
2113 2126
2114 .. _strip_zeros: 2127 .. _strip_zeros:
2115 2128
2116 Note that a leading string of 0's will be stripped from the id part of 2129 Note that Roundup strips a leading string of 0's from the id part of
2117 the object :term:`designator` in the URL. E.G. ``/issue001`` is the 2130 the object :term:`designator` in the URL. E.G. ``/issue001`` is the
2118 same as ``/issue1``. Similarly for ``/file01`` etc. However you 2131 same as ``/issue1``. Similarly for ``/file01`` etc. However you
2119 should generate URL's without the extra zeros. 2132 should generate URL's without the extra zeros.
2120 2133
2121 Determining web context 2134 Determining web context
2122 ----------------------- 2135 -----------------------
2123 2136
2124 To determine the "context" of a request (what request is for), we look at 2137 To determine the "context" of a request (what request is for),
2125 the URL path after the tracker root and at ``@template`` request 2138 Roundup looks at the URL path after the tracker root and at
2126 parameter. Typical URL paths look like: 2139 ``@template`` request parameter. Typical URL paths look like:
2127 2140
2128 1. ``/tracker/issue`` 2141 1. ``/tracker/``
2129 2. ``/tracker/issue1`` 2142 2. ``/tracker/issue``
2130 3. ``/tracker/@@file/style.css`` 2143 3. ``/tracker/issue1``
2131 4. ``/cgi-bin/roundup.cgi/tracker/file1`` 2144 4. ``/tracker/@@file/style.css``
2132 5. ``/cgi-bin/roundup.cgi/tracker/file1/kitten.png`` 2145 5. ``/cgi-bin/roundup.cgi/tracker/file1``
2146 6. ``/cgi-bin/roundup.cgi/tracker/file1/kitten.png``
2133 2147
2134 where tracker root is ``/tracker/`` or ``/cgi-bin/roundup.cgi/tracker/`` 2148 where tracker root is ``/tracker/`` or ``/cgi-bin/roundup.cgi/tracker/``
2135 We're looking at "issue", "issue1", "@@file/style.css", "file1" and 2149 We're looking at "issue", "issue1", "@@file/style.css", "file1" and
2136 "file1/kitten.png" in the cases above. 2150 "file1/kitten.png" in the cases above.
2137 2151
2138 1. with is no path we are in the "home" context. See `the "home" 2152 1. with no path Roundup is in the "home" context. See `the "home"
2139 context`_ below for details. "index" or "home" paths may also be used 2153 context`_ below for details. "index" or "home" paths may also be used
2140 to switch into "home" context. 2154 to switch into "home" context.
2141 2. for paths starting with "@@file" the additional path entry ("style.css" 2155 2. if there is something in the path (as in example 2, "issue"), it
2156 identifies the tracker class to display.
2157 3. if the path is an item designator (as in examples 3 and 5, "issue1"
2158 and "file1"), then we're to display a specific item.
2159 :ref:`Note. <strip_zeros>`
2160 4. for paths starting with "@@file" the additional path entry ("style.css"
2142 in the example above) specifies the static file to be served 2161 in the example above) specifies the static file to be served
2143 from the tracker TEMPLATES directory (or STATIC_FILES, if configured). 2162 from the tracker TEMPLATES directory (or STATIC_FILES, if configured).
2144 This is usually the tracker's "html" directory. Internally this works 2163 The TEMPLATES directory is usually the tracker's "html"
2145 by raising SendStaticFile exception. 2164 directory. Internally this works by raising SendStaticFile exception.
2146 3. if there is something in the path (as in example 1, "issue"), it 2165 5. A file can have additional path components (as in example
2147 identifies the tracker class to display. 2166 6). Without the additional components, the metadata for the
2148 4. if the path is an item designator (as in examples 2 and 4, "issue1" 2167 file is displayed.
2149 and "file1"), then we're to display a specific item. 2168 6. if the path starts with an item designator and is longer than one
2150 :ref:`Note. <strip_zeros>`
2151 5. if the path starts with an item designator and is longer than one
2152 entry (as in example 5, "file1/kitten.png"), then we're assumed to be 2169 entry (as in example 5, "file1/kitten.png"), then we're assumed to be
2153 handling an item of a ``FileClass``, and the extra path information 2170 handling an item of a ``FileClass``, and the extra path information
2154 gives the filename that the client is going to label the download 2171 gives the filename that the client is going to label the download
2155 with (i.e. "file1/kitten.png" is nicer to download than "file1"). 2172 with (i.e. "file1/kitten.png" is nicer to download than "file1").
2156 This raises a ``SendFile`` exception. 2173 This raises a ``SendFile`` exception.
2157 2174
2158 Neither 2. or 5. use templates and stop before the template is 2175 Neither 4. or 6. use templates and stop before the template is
2159 determined. For other contexts the template used is specified by the 2176 determined. For other contexts the template used is specified by the
2160 ``@template`` variable, which defaults to: 2177 ``@template`` variable, which defaults to:
2161 2178
2162 - only classname supplied: "index" 2179 - only classname supplied: "index"
2163 - full item designator supplied: "item" 2180 - full item designator supplied: "item"
2165 2182
2166 The "home" Context 2183 The "home" Context
2167 ------------------ 2184 ------------------
2168 2185
2169 The "home" context is special because it allows you to add templated 2186 The "home" context is special because it allows you to add templated
2170 pages to your tracker that don't rely on a class or item (ie. an issues 2187 pages to your tracker that don't rely on a class or item (e.g. an issues
2171 list or specific issue). 2188 list or specific issue).
2172 2189
2173 Let's say you wish to add frames to control the layout of your tracker's 2190 Let's say you wish to add frames to control the layout of your tracker's
2174 interface. You'd probably have: 2191 interface. You'd probably have:
2175 2192
2219 log them in. 2236 log them in.
2220 2237
2221 **edit** 2238 **edit**
2222 Perform an edit of an item in the database. There are some `special form 2239 Perform an edit of an item in the database. There are some `special form
2223 variables`_ you may use. Also you can set the ``__redirect_to`` form 2240 variables`_ you may use. Also you can set the ``__redirect_to`` form
2224 variable to the URL that should be displayed after the edit is succesfully 2241 variable to the URL to display after the edit is successfully
2225 completed. If you wanted to edit a sequence of issues, users etc. this 2242 completed. If you wanted to edit a sequence of issues, users etc. this
2226 could be used to display the next item in the sequence to the user. 2243 could be used to display the next item in the sequence to the user.
2227 2244
2228 **new** 2245 **new**
2229 Add a new item to the database. You may use the same `special form 2246 Add a new item to the database. You may use the same `special form
2230 variables`_ as in the "edit" action. Also you can set the 2247 variables`_ as in the "edit" action. Also you can set the
2231 ``__redirect_to`` form variable to the URL that should be displayed after 2248 ``__redirect_to`` form variable to the URL to display after
2232 the new item is created. This is useful if you want to create another 2249 the new item is created. This is useful if you want to create another
2233 item rather than edit the newly created item. 2250 item rather than edit the newly created item.
2234 2251
2235 **retire** 2252 **retire**
2236 Retire the item in the database. 2253 Retire the item in the database.
2243 2260
2244 **search** 2261 **search**
2245 Mangle some of the form variables: 2262 Mangle some of the form variables:
2246 2263
2247 - Set the form ":filter" variable based on the values of the filter 2264 - Set the form ":filter" variable based on the values of the filter
2248 variables - if they're set to anything other than "dontcare" then add 2265 variables - if they are set to anything other than "dontcare" then add
2249 them to :filter. 2266 them to :filter.
2250 2267
2251 - Also handle the ":queryname" variable and save off the query to the 2268 - Also handle the ":queryname" variable and save off the query to the
2252 user's query list. 2269 user's query list.
2253 2270
2284 Protecting users from web application attacks 2301 Protecting users from web application attacks
2285 --------------------------------------------- 2302 ---------------------------------------------
2286 2303
2287 There is a class of attacks known as Cross Site Request Forgeries 2304 There is a class of attacks known as Cross Site Request Forgeries
2288 (CSRF). Malicious code running in the browser can making a 2305 (CSRF). Malicious code running in the browser can making a
2289 request to Roundup while you are logged into Roundup. The 2306 request to Roundup while you are logged into Roundup. The
2290 malicious code piggy backs on your existing Roundup session to 2307 malicious code piggy backs on your existing Roundup session to
2291 make changes without your knowledge. Roundup 1.6 has support for 2308 make changes without your knowledge. Roundup 1.6 has support for
2292 defending against this by analyzing the 2309 defending against this by analyzing the
2293 2310
2294 * Referer, 2311 * Referer,
2299 HTTP headers. It compares the headers to the value of the web setting 2316 HTTP headers. It compares the headers to the value of the web setting
2300 in the [tracker] section of the tracker's ``config.ini``. 2317 in the [tracker] section of the tracker's ``config.ini``.
2301 2318
2302 Also a per form token (also called a nonce) can be enabled for 2319 Also a per form token (also called a nonce) can be enabled for
2303 the tracker using the ``csrf_enforce_token`` option in 2320 the tracker using the ``csrf_enforce_token`` option in
2304 config.ini. When enabled, Roundup will validate a hidden form 2321 config.ini. When enabled, Roundup will check a hidden form field
2305 field called ``@csrf``. If the validation fails (or the token 2322 called ``@csrf``. If the field's value matches a token in the
2306 is used more than once) the request is rejected. The ``@csrf`` 2323 database, the validation passes and the token is deleted. If the
2307 input field is added automatically by calling the ``submit`` 2324 validation fails because the token is not found (e.g. if the
2308 function/path. It can also be added manually by calling 2325 token is used more than once) the request is rejected. The
2309 anti_csrf_nonce() directly. For example:: 2326 ``@csrf`` input field is added automatically when calling the
2327 ``submit`` function/path. It can also be added manually by
2328 calling anti_csrf_nonce() directly. For example::
2310 2329
2311 <input name="@csrf" type="hidden" 2330 <input name="@csrf" type="hidden"
2312 tal:attributes="value python:utils.anti_csrf_nonce(lifetime=10)"> 2331 tal:attributes="value python:utils.anti_csrf_nonce(lifetime=10)">
2313 2332
2314 By default a nonce lifetime is 2 weeks. However the lifetime (in 2333 By default a nonce lifetime is 2 weeks. However the lifetime (in
2315 minutes) can be set by passing a lifetime argument as shown 2334 minutes) can be set by passing a lifetime argument as shown
2316 above. The example above makes the nonce lifetime 10 minutes. 2335 above. The example above makes the nonce lifetime 10 minutes.
2317 2336
2318 Search for @csrf in this document for more examples. There are 2337 Search for @csrf in this document for more examples. More
2319 more examples and information in ``upgrading.txt``. 2338 examples and information is provided in ``upgrading.txt``.
2320 2339
2321 The token protects you because malicious code supplied by another 2340 The token protects you because malicious code supplied by another
2322 site is unable to obtain the token. Thus many attempts they make 2341 site is unable to obtain the token. Thus any attempt they make
2323 to submit a request are rejected. 2342 to submit a request is rejected.
2324 2343
2325 The protection on the xmlrpc interface is untested, but is based 2344 The protection on the xmlrpc interface is untested, but is based
2326 on a valid header check against the Roundup url and the presence 2345 on a valid header check against the Roundup URL and the presence
2327 of the ``X-REQUESTED-WITH`` header. Work to improve this is a 2346 of the ``X-REQUESTED-WITH`` header. Work to improve this is a
2328 future project after the 1.6 release. 2347 future project after the 1.6 release.
2329 2348
2330 The enforcement levels can be modified in ``config.ini``. Refer to 2349 The enforcement levels can be modified in ``config.ini``. Refer to
2331 that file for details. 2350 that file for details.
2353 ``@action`` variable) is "edit" or "new". 2372 ``@action`` variable) is "edit" or "new".
2354 2373
2355 In the following, <bracketed> values are variable, "@" may be 2374 In the following, <bracketed> values are variable, "@" may be
2356 either ":" or "@", and other text "required" is fixed. 2375 either ":" or "@", and other text "required" is fixed.
2357 2376
2377 .. index::
2378 single: i18n; set from web interface
2379 single: internationalization; set from web interface
2380 single: language; set from web interface
2381
2358 Two special form variables are used to specify user language preferences: 2382 Two special form variables are used to specify user language preferences:
2359 2383
2360 ``@language`` 2384 ``@language``
2361 value may be locale name or ``none``. If this variable is set to 2385 value may be locale name or ``none``. If this variable is set to
2362 locale name, web interface language is changed to given value 2386 locale name, web interface language is changed to given value
2363 (provided that appropriate translation is available), the value 2387 (if the appropriate translation is available). The value
2364 is stored in the browser cookie and will be used for all following 2388 is stored in a browser cookie and is used for all following
2365 requests. If value is ``none`` the cookie is removed and the 2389 requests. If value is ``none`` the cookie is removed and the
2366 language is changed to the tracker default, set up in the tracker 2390 language is changed to the tracker default, set up in the tracker
2367 configuration or OS environment. 2391 configuration or OS environment.
2368 2392
2369 ``@charset`` 2393 ``@charset``
2370 value may be character set name or ``none``. Character set name 2394 value may be character set name or ``none``. Character set name
2371 is stored in the browser cookie and sets output encoding for all 2395 is stored in a browser cookie and sets output encoding for all
2372 HTML pages generated by Roundup. If value is ``none`` the cookie 2396 HTML pages generated by Roundup. If value is ``none`` the cookie
2373 is removed and HTML output is reset to Roundup internal encoding 2397 is removed and HTML output is reset to Roundup internal encoding
2374 (UTF-8). 2398 (UTF-8). This is unlikely to be needed with modern web browsers
2399 and is left over from the early days of the web. It will
2400 be removed at some future date.
2375 2401
2376 Most properties are specified as form variables: 2402 Most properties are specified as form variables:
2377 2403
2378 ``<propname>`` 2404 ``<propname>``
2379 property on the current context item 2405 property on the current context item
2391 submission is successful, a new item of <classname> is 2417 submission is successful, a new item of <classname> is
2392 created. Within the submitted form, a particular 2418 created. Within the submitted form, a particular
2393 designator of this form always refers to the same new 2419 designator of this form always refers to the same new
2394 item. 2420 item.
2395 2421
2396 Once we have determined the "propname", we look at it to see 2422 Once we have determined the "propname", we check to see
2397 if it's special: 2423 if it's special:
2398 2424
2399 ``@required`` 2425 ``@required``
2400 The associated form value is a comma-separated list of 2426 The associated form value is a comma-separated list of
2401 property names that must be specified when the form is 2427 property names that must be specified when the form is
2409 The "@required" specifier must come before any of the 2435 The "@required" specifier must come before any of the
2410 properties it refers to are assigned in the form. 2436 properties it refers to are assigned in the form.
2411 2437
2412 ``@remove@<propname>=id(s)`` or ``@add@<propname>=id(s)`` 2438 ``@remove@<propname>=id(s)`` or ``@add@<propname>=id(s)``
2413 The "@add@" and "@remove@" edit actions apply only to 2439 The "@add@" and "@remove@" edit actions apply only to
2414 Multilink properties. The form value must be a 2440 Multilink properties. The form value must be a
2415 comma-separate list of keys for the class specified by 2441 comma-separate list of keys for the class specified by
2416 the simple form variable. The listed items are added 2442 the simple form variable. The listed items are added
2417 to (respectively, removed from) the specified 2443 to (respectively, removed from) the specified
2418 property. 2444 property.
2419 2445
2420 ``@link@<propname>=<designator>`` 2446 ``@link@<propname>=<designator>``
2421 If the edit action is "@link@", the simple form 2447 If the edit action is "@link@", the simple form
2422 variable must specify a Link or Multilink property. 2448 variable must specify a Link or Multilink property.
2423 The form value is a comma-separated list of 2449 The form value is a comma-separated list of
2424 designators. The item corresponding to each 2450 designators. The item corresponding to each
2425 designator is linked to the property given by simple 2451 designator is linked to the property given by simple
2426 form variable. 2452 form variable.
2427 2453
2428 None of the above (ie. just a simple form value) 2454 None of the above (i.e. just a simple form value)
2429 The value of the form variable is converted 2455 The value of the form variable is converted
2430 appropriately, depending on the type of the property. 2456 appropriately, depending on the type of the property.
2431 2457
2432 For a Link('klass') property, the form value is a 2458 For a Link('klass') property, the form value is a
2433 single key for 'klass', where the key field is 2459 single key (or id number) for 'klass',
2434 specified in schema.py. 2460 where the key field is specified in schema.py.
2435 2461
2436 For a Multilink('klass') property, the form value is a 2462 For a Multilink('klass') property, the form value is a
2437 comma-separated list of keys for 'klass', where the 2463 comma-separated list of keys (or id nummber) for 'klass', where the
2438 key field is specified in schema.py. 2464 key field is specified in schema.py.
2439 2465
2440 Note that for simple-form-variables specifiying Link 2466 Note that for simple-form-variables specifying Link
2441 and Multilink properties, the linked-to class must 2467 and Multilink properties, the linked-to class must
2442 have a key field. 2468 have a key field.
2443 2469
2444 For a String() property specifying a filename, the 2470 For a String() property specifying a filename, the
2445 file named by the form value is uploaded. This means we 2471 file named by the form value is uploaded. This means we
2446 try to set additional properties "filename" and "type" (if 2472 try to set additional properties "filename" and "type" (if
2447 they are valid for the class). Otherwise, the property 2473 they are defined for the class). Otherwise, the property
2448 is set to the form value. 2474 is set to the form value.
2449 2475
2450 For Date(), Interval(), Boolean(), Integer() and Number() 2476 For Date(), Interval(), Boolean(), Integer() and Number()
2451 properties, the form value is converted to the 2477 properties, the form value is converted to the
2452 appropriate value. 2478 appropriate value.
2453 2479
2454 Any of the form variables may be prefixed with a classname or 2480 Any of the form variables may be prefixed with a classname or
2455 designator. 2481 designator.
2456 2482
2457 Setting the form variable: ``__redirect_to=`` to a url when 2483 Setting the form variable: ``__redirect_to=`` to a url when
2458 @action=new redirects the user to the specified url after successfully 2484 ``@action=new`` redirects the user to the specified url after
2459 creating the new item. This is useful if you want the user to create 2485 successfully creating the new item. This is useful if you want
2460 another item rather than edit the newly created item. Note that the 2486 the user to create another item rather than edit the newly
2461 url assigned to ``__redirect_to`` must be url encoded/quoted and be 2487 created item. Note that the url assigned to ``__redirect_to``
2462 under the tracker's base url. If the base_url uses http, you can set 2488 must be url encoded/quoted and be under the tracker's base
2463 the url to https. 2489 url. If the base_url uses http, you can set the url to https.
2464 2490
2465 Two special form values are supported for backwards compatibility: 2491 Two special form values are supported for backwards compatibility:
2466 2492
2467 @note 2493 @note
2468 This is equivalent to:: 2494 This is equivalent to::
2517 Most customisation of the web view can be done by modifying the 2543 Most customisation of the web view can be done by modifying the
2518 templates in the tracker ``'html'`` directory. There are several types 2544 templates in the tracker ``'html'`` directory. There are several types
2519 of files in there. The *minimal* template includes: 2545 of files in there. The *minimal* template includes:
2520 2546
2521 **page.html** 2547 **page.html**
2522 This template usually defines the overall look of your tracker. When 2548 This template defines the overall look of your tracker. When
2523 you view an issue, it appears inside this template. When you view an 2549 you view an issue, it appears inside this template. When you view an
2524 index, it also appears inside this template. This template defines a 2550 index, it also appears inside this template. This template defines a
2525 macro called "icing" which is used by almost all other templates as a 2551 macro called "icing" which is used by almost all other templates as a
2526 coating for their content, using its "content" slot. It also defines 2552 coating for their content, using its "content" slot. It also defines
2527 the "head_title" and "body_title" slots to allow setting of the page 2553 the "head_title" and "body_title" slots to allow setting of the page
2528 title. 2554 title.
2529 **home.html** 2555 **home.html**
2530 the default page displayed when no other page is indicated by the user 2556 the default page displayed when in `the "home" context`_ and no
2557 other page is requested using the ``@template`` parameter
2531 **home.classlist.html** 2558 **home.classlist.html**
2532 a special version of the default page that lists the classes in the 2559 a special version of the default page that lists the classes in the
2533 tracker 2560 tracker. It is requested in the "home" context using ``@template=classlist``
2534 **classname.item.html** 2561 **classname.item.html**
2535 displays an item of the *classname* class 2562 displays an item of the *classname* class given a :term:`designator`
2536 **classname.index.html** 2563 **classname.index.html**
2537 displays a list of *classname* items 2564 displays a list of *classname* items
2538 **classname.search.html** 2565 **classname.search.html**
2539 displays a search page for *classname* items 2566 displays a search page for *classname* items
2540 **_generic.index.html** 2567 **_generic.index.html**
2541 used to display a list of items where there is no 2568 used to display a list of items when there is no
2542 ``*classname*.index`` available 2569 ``*classname*.index`` available
2543 **_generic.help.html** 2570 **_generic.help.html**
2544 used to display a "class help" page where there is no 2571 used to display a "class help" page when there is no
2545 ``*classname*.help`` 2572 ``*classname*.help``
2546 **user.register.html** 2573 **user.register.html**
2547 a special page just for the user class, that renders the registration 2574 a special page just for the user class, that renders the registration
2548 page 2575 page
2549 **style.css** 2576 **style.css**
2551 2578
2552 The *classic* template has a number of additional templates. 2579 The *classic* template has a number of additional templates.
2553 2580
2554 Remember that you can create any template extension you want to, 2581 Remember that you can create any template extension you want to,
2555 so if you just want to play around with the templating for new issues, 2582 so if you just want to play around with the templating for new issues,
2556 you can copy the current "issue.item" template to "issue.test", and then 2583 you can copy the current "issue.item.html" template to
2584 "issue.test" (or "issue.test.html"), and then
2557 access the test template using the "@template" URL argument:: 2585 access the test template using the "@template" URL argument::
2558 2586
2559 http://your.tracker.example/tracker/issue?@template=test 2587 http://your.tracker.example/tracker/issue?@template=test
2560 2588
2561 and it won't affect your users using the "issue.item" template. 2589 and it won't affect your users using the "issue.item" template.

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