[7195] | 1 | ## $Id: permissions.py 17253 2022-12-29 09:15:31Z henrik $ |
---|
| 2 | ## |
---|
[6953] | 3 | ## Copyright (C) 2011 Uli Fouquet & Henrik Bettermann |
---|
| 4 | ## This program is free software; you can redistribute it and/or modify |
---|
| 5 | ## it under the terms of the GNU General Public License as published by |
---|
| 6 | ## the Free Software Foundation; either version 2 of the License, or |
---|
| 7 | ## (at your option) any later version. |
---|
| 8 | ## |
---|
| 9 | ## This program is distributed in the hope that it will be useful, |
---|
| 10 | ## but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
| 11 | ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
| 12 | ## GNU General Public License for more details. |
---|
| 13 | ## |
---|
| 14 | ## You should have received a copy of the GNU General Public License |
---|
| 15 | ## along with this program; if not, write to the Free Software |
---|
| 16 | ## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
---|
| 17 | ## |
---|
| 18 | """ |
---|
| 19 | Permissions for the accommdation section. |
---|
| 20 | """ |
---|
| 21 | import grok |
---|
| 22 | |
---|
| 23 | # Accommodation section permissions |
---|
| 24 | |
---|
| 25 | class ViewHostels(grok.Permission): |
---|
[15277] | 26 | """The ViewHostels permission is applied to all views of the |
---|
| 27 | Accommodation Section. Users with this permission can view but not edit |
---|
| 28 | data in the Accommodation Section. |
---|
| 29 | """ |
---|
[6953] | 30 | grok.name('waeup.viewHostels') |
---|
| 31 | |
---|
| 32 | class ManageHostels(grok.Permission): |
---|
[15277] | 33 | """The ManageHostels permission is applied to manage pages in the |
---|
| 34 | Accommodation Section. |
---|
| 35 | """ |
---|
[6953] | 36 | grok.name('waeup.manageHostels') |
---|
| 37 | |
---|
[15277] | 38 | class ExportAccommodationData(grok.Permission): |
---|
| 39 | """Accommodation Officers don't have the general exportData |
---|
| 40 | permission and are only allowed to export accommodation data |
---|
| 41 | (accommodation payment tickets and bed tickets). |
---|
| 42 | The ExportAccommodationData permission is only used to filter the |
---|
| 43 | respective exporters in the ExportJobContainerJobConfig view. |
---|
| 44 | """ |
---|
| 45 | grok.name('waeup.exportAccommodationData') |
---|
| 46 | |
---|
[7178] | 47 | # Site Roles |
---|
[6953] | 48 | class AccommodationOfficer(grok.Role): |
---|
[15277] | 49 | """Accommodation Officers can view and manage hostels. They can also export |
---|
[15279] | 50 | student accommodation data (filtered payment tickets and bed tickets). |
---|
[15277] | 51 | They can't access the Data Center but see student data export buttons |
---|
| 52 | in the Academic Section. |
---|
| 53 | """ |
---|
[6953] | 54 | grok.name('waeup.AccommodationOfficer') |
---|
| 55 | grok.title(u'Accommodation Officer') |
---|
[15277] | 56 | grok.permissions('waeup.viewHostels', |
---|
| 57 | 'waeup.manageHostels', |
---|
| 58 | 'waeup.showStudents', |
---|
| 59 | 'waeup.viewAcademics', |
---|
| 60 | 'waeup.exportAccommodationData') |
---|
[17253] | 61 | |
---|
| 62 | class AccommodationViewer(grok.Role): |
---|
| 63 | """Accommodation Viewers can view but not manage hostels. They can also export |
---|
| 64 | student accommodation data (filtered payment tickets and bed tickets). |
---|
| 65 | They can't access the Data Center but see student data export buttons |
---|
| 66 | in the Academic Section. |
---|
| 67 | """ |
---|
| 68 | grok.name('waeup.AccommodationViewer') |
---|
| 69 | grok.title(u'Accommodation Viewer') |
---|
| 70 | grok.permissions('waeup.viewHostels', |
---|
| 71 | 'waeup.showStudents', |
---|
| 72 | 'waeup.viewAcademics', |
---|
| 73 | 'waeup.exportAccommodationData') |
---|