Mercurial > p > roundup > code
comparison doc/customizing.txt @ 6466:258385cad27e
Add search perm and update default perms
Search permission was not documented. Add that.
Doc of schema permissions had diverged from classic
template. Update from current classic template.
| author | John Rouillard <rouilj@ieee.org> |
|---|---|
| date | Wed, 11 Aug 2021 12:45:04 -0400 |
| parents | 2bd60def4fed |
| children | 60532cafc62a |
comparison
equal
deleted
inserted
replaced
| 6465:bed1313898d4 | 6466:258385cad27e |
|---|---|
| 1692 | 1692 |
| 1693 A set of Permissions is built into the security module by default: | 1693 A set of Permissions is built into the security module by default: |
| 1694 | 1694 |
| 1695 - Create (everything) | 1695 - Create (everything) |
| 1696 - Edit (everything) | 1696 - Edit (everything) |
| 1697 - Search (everything) (used if View does not permit access) | |
| 1697 - View (everything) | 1698 - View (everything) |
| 1698 - Register (User class only) | 1699 - Register (User class only) |
| 1699 | 1700 |
| 1700 These are assigned to the "Admin" Role by default, and allow a user to do | 1701 These are assigned to the "Admin" Role by default, and allow a user to do |
| 1701 anything. Every Class you define in your `tracker schema`_ also gets an | 1702 anything. Every Class you define in your `tracker schema`_ also gets an |
| 1719 `directions in the rest interface documentation`_ and the | 1720 `directions in the rest interface documentation`_ and the |
| 1720 `xmlrpc interface documentation`_. | 1721 `xmlrpc interface documentation`_. |
| 1721 | 1722 |
| 1722 These are hooked into the default Roles: | 1723 These are hooked into the default Roles: |
| 1723 | 1724 |
| 1724 - Admin (Create, Edit, View and everything; Web Roles) | 1725 - Admin (Create, Edit, Search, View and everything; Web Roles) |
| 1725 - User (Web Access; Email Access) | 1726 - User (Web Access; Email Access) |
| 1726 - Anonymous (Web Access) | 1727 - Anonymous (Web Access) |
| 1727 | 1728 |
| 1728 And finally, the "admin" user gets the "Admin" Role, and the "anonymous" | 1729 And finally, the "admin" user gets the "Admin" Role, and the "anonymous" |
| 1729 user gets "Anonymous" assigned when the tracker is installed. | 1730 user gets "Anonymous" assigned when the tracker is installed. |
| 1758 db.security.addPermissionToRole('User', 'Rest Access') | 1759 db.security.addPermissionToRole('User', 'Rest Access') |
| 1759 db.security.addPermissionToRole('User', 'Xmlrpc Access') | 1760 db.security.addPermissionToRole('User', 'Xmlrpc Access') |
| 1760 | 1761 |
| 1761 # Assign the access and edit Permissions for issue, file and message | 1762 # Assign the access and edit Permissions for issue, file and message |
| 1762 # to regular users now | 1763 # to regular users now |
| 1763 for cl in 'issue', 'file', 'msg', 'query', 'keyword': | 1764 for cl in 'issue', 'file', 'msg', 'keyword': |
| 1764 db.security.addPermissionToRole('User', 'View', cl) | 1765 db.security.addPermissionToRole('User', 'View', cl) |
| 1765 db.security.addPermissionToRole('User', 'Edit', cl) | 1766 db.security.addPermissionToRole('User', 'Edit', cl) |
| 1766 db.security.addPermissionToRole('User', 'Create', cl) | 1767 db.security.addPermissionToRole('User', 'Create', cl) |
| 1767 for cl in 'priority', 'status': | 1768 for cl in 'priority', 'status': |
| 1768 db.security.addPermissionToRole('User', 'View', cl) | 1769 db.security.addPermissionToRole('User', 'View', cl) |
| 1769 | 1770 |
| 1770 # May users view other user information? Comment these lines out | 1771 # May users view other user information? Comment these lines out |
| 1771 # if you don't want them to | 1772 # if you don't want them to |
| 1772 db.security.addPermissionToRole('User', 'View', 'user') | 1773 p = db.security.addPermission(name='View', klass='user', |
| 1773 | 1774 properties=('id', 'organisation', 'phone', 'realname', 'timezone', |
| 1774 # Users should be able to edit their own details -- this permission | 1775 'username')) |
| 1775 # is limited to only the situation where the Viewed or Edited item | 1776 db.security.addPermissionToRole('User', p) |
| 1776 # is their own. | 1777 |
| 1778 # Users should be able to edit their own details -- this permission is | |
| 1779 # limited to only the situation where the Viewed or Edited item is their own. | |
| 1777 def own_record(db, userid, itemid, **ctx): | 1780 def own_record(db, userid, itemid, **ctx): |
| 1778 '''Determine whether the userid matches the item being accessed.''' | 1781 '''Determine whether the userid matches the item being accessed.''' |
| 1779 return userid == itemid | 1782 return userid == itemid |
| 1780 p = db.security.addPermission(name='View', klass='user', check=own_record, | 1783 p = db.security.addPermission(name='View', klass='user', check=own_record, |
| 1781 description="User is allowed to view their own user details") | 1784 description="User is allowed to view their own user details") |
| 1782 db.security.addPermissionToRole('User', p) | 1785 db.security.addPermissionToRole('User', p) |
| 1783 p = db.security.addPermission(name='Edit', klass='user', check=own_record, | 1786 p = db.security.addPermission(name='Edit', klass='user', check=own_record, |
| 1787 properties=('username', 'password', 'address', 'realname', 'phone', | |
| 1788 'organisation', 'alternate_addresses', 'queries', 'timezone'), | |
| 1784 description="User is allowed to edit their own user details") | 1789 description="User is allowed to edit their own user details") |
| 1790 db.security.addPermissionToRole('User', p) | |
| 1791 | |
| 1792 # Users should be able to edit and view their own queries. They should also | |
| 1793 # be able to view any marked as not private. They should not be able to | |
| 1794 # edit others' queries, even if they're not private | |
| 1795 def view_query(db, userid, itemid): | |
| 1796 private_for = db.query.get(itemid, 'private_for') | |
| 1797 if not private_for: return True | |
| 1798 return userid == private_for | |
| 1799 def edit_query(db, userid, itemid): | |
| 1800 return userid == db.query.get(itemid, 'creator') | |
| 1801 p = db.security.addPermission(name='View', klass='query', check=view_query, | |
| 1802 description="User is allowed to view their own and public queries") | |
| 1803 db.security.addPermissionToRole('User', p) | |
| 1804 p = db.security.addPermission(name='Search', klass='query') | |
| 1805 db.security.addPermissionToRole('User', p) | |
| 1806 p = db.security.addPermission(name='Edit', klass='query', check=edit_query, | |
| 1807 description="User is allowed to edit their queries") | |
| 1808 db.security.addPermissionToRole('User', p) | |
| 1809 p = db.security.addPermission(name='Retire', klass='query', check=edit_query, | |
| 1810 description="User is allowed to retire their queries") | |
| 1811 db.security.addPermissionToRole('User', p) | |
| 1812 p = db.security.addPermission(name='Restore', klass='query', check=edit_query, | |
| 1813 description="User is allowed to restore their queries") | |
| 1814 db.security.addPermissionToRole('User', p) | |
| 1815 p = db.security.addPermission(name='Create', klass='query', | |
| 1816 description="User is allowed to create queries") | |
| 1785 db.security.addPermissionToRole('User', p) | 1817 db.security.addPermissionToRole('User', p) |
| 1786 | 1818 |
| 1787 # | 1819 # |
| 1788 # ANONYMOUS USER PERMISSIONS | 1820 # ANONYMOUS USER PERMISSIONS |
| 1789 # | 1821 # |
| 1800 #db.security.addPermissionToRole('Anonymous', 'Email Access') | 1832 #db.security.addPermissionToRole('Anonymous', 'Email Access') |
| 1801 | 1833 |
| 1802 # Assign the appropriate permissions to the anonymous user's Anonymous | 1834 # Assign the appropriate permissions to the anonymous user's Anonymous |
| 1803 # Role. Choices here are: | 1835 # Role. Choices here are: |
| 1804 # - Allow anonymous users to register | 1836 # - Allow anonymous users to register |
| 1805 db.security.addPermissionToRole('Anonymous', 'Create', 'user') | 1837 db.security.addPermissionToRole('Anonymous', 'Register', 'user') |
| 1806 | 1838 |
| 1807 # Allow anonymous users access to view issues (and the related, linked | 1839 # Allow anonymous users access to view issues (and the related, linked |
| 1808 # information) | 1840 # information) |
| 1809 for cl in 'issue', 'file', 'msg', 'keyword', 'priority', 'status': | 1841 for cl in 'issue', 'file', 'msg', 'keyword', 'priority', 'status': |
| 1810 db.security.addPermissionToRole('Anonymous', 'View', cl) | 1842 db.security.addPermissionToRole('Anonymous', 'View', cl) |
| 1843 | |
| 1844 # Allow the anonymous user to use the "Show Unassigned" search. | |
| 1845 # It acts like "Show Open" if this permission is not available. | |
| 1846 # If you are running a tracker that does not allow read access for | |
| 1847 # anonymous, you should remove this entry as it can be used to perform | |
| 1848 # a username guessing attack against a roundup install. | |
| 1849 p = db.security.addPermission(name='Search', klass='user') | |
| 1850 db.security.addPermissionToRole ('Anonymous', p) | |
| 1811 | 1851 |
| 1812 # [OPTIONAL] | 1852 # [OPTIONAL] |
| 1813 # Allow anonymous users access to create or edit "issue" items (and the | 1853 # Allow anonymous users access to create or edit "issue" items (and the |
| 1814 # related file and message items) | 1854 # related file and message items) |
| 1815 #for cl in 'issue', 'file', 'msg': | 1855 #for cl in 'issue', 'file', 'msg': |
