Changeset 14603 for main/waeup.kofa/trunk/src/waeup/kofa/permissions.py
- Timestamp:
- 6 Mar 2017, 16:37:31 (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.kofa/trunk/src/waeup/kofa/permissions.py
r14602 r14603 1 # #$Id$2 # #3 # #Copyright (C) 2011 Uli Fouquet & Henrik Bettermann4 # #This program is free software; you can redistribute it and/or modify5 # #it under the terms of the GNU General Public License as published by6 # #the Free Software Foundation; either version 2 of the License, or7 # #(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 of11 # #MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the12 # #GNU General Public License for more details.13 # #14 # #You should have received a copy of the GNU General Public License15 # #along with this program; if not, write to the Free Software16 # #Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA17 # #1 # $Id$ 2 # 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 18 import grok 19 19 from zope.component import getUtilitiesFor … … 22 22 from waeup.kofa.interfaces import ILocalRolesAssignable 23 23 24 24 25 class Public(grok.Permission): 25 26 """The Public or everyone-can-do-this-permission is being applied … … 27 28 """ 28 29 grok.name('waeup.Public') 30 29 31 30 32 class Anonymous(grok.Permission): … … 35 37 grok.name('waeup.Anonymous') 36 38 39 37 40 class Authenticated(grok.Permission): 38 41 """The Authenticated permission is applied to pages … … 40 43 """ 41 44 grok.name('waeup.Authenticated') 45 42 46 43 47 class ViewAcademics(grok.Permission): … … 48 52 grok.name('waeup.viewAcademics') 49 53 54 50 55 class ManageAcademics(grok.Permission): 51 56 """The ManageAcademics permission is applied to all edit/manage … … 55 60 grok.name('waeup.manageAcademics') 56 61 62 57 63 class ManagePortal(grok.Permission): 58 64 """The ManagePortal permission is used for very few pages 59 (e.g. the DatacenterSettings page). Only PortalManagers have this 65 (e.g. the DatacenterSettings page). Only PortalManagers have this 60 66 permission. It is furthermore used to control delete methods of container 61 67 pages in the Academic Section. The ManageAcademics permission, … … 67 73 grok.name('waeup.managePortal') 68 74 75 69 76 class ManageUsers(grok.Permission): 70 77 """The ManageUsers permission is a real superuser permission … … 72 79 user accounts. Editing a user account includes the option to assign 73 80 or remove roles. That means that a user with this permission can lock out 74 other users by either removing their account or by removing 81 other users by either removing their account or by removing 75 82 permissions. 76 83 """ 77 84 grok.name('waeup.manageUsers') 85 78 86 79 87 class ShowStudents(grok.Permission): … … 89 97 grok.name('waeup.showStudents') 90 98 99 91 100 class ClearAllStudents(grok.Permission): 92 101 """The ClearAllStudents permission allows to clear all students … … 95 104 grok.name('waeup.clearAllStudents') 96 105 106 97 107 class EditScores(grok.Permission): 98 108 """The EditScores permission allows to edit scores in course tickets. 99 109 """ 100 110 grok.name('waeup.editScores') 111 101 112 102 113 class TriggerTransition(grok.Permission): … … 106 117 grok.name('waeup.triggerTransition') 107 118 119 108 120 class EditUser(grok.Permission): 109 121 """The EditUser permission is required for editing … … 111 123 """ 112 124 grok.name('waeup.editUser') 125 113 126 114 127 class ManageDataCenter(grok.Permission): … … 119 132 grok.name('waeup.manageDataCenter') 120 133 134 121 135 class ImportData(grok.Permission): 122 """The ImportData permission allows to batch process (import) any kind of 136 """The ImportData permission allows to batch process (import) any kind of 123 137 portal data except for user data. The User Data processor 124 138 requires also the ManageUsers permission. … … 126 140 grok.name('waeup.importData') 127 141 142 128 143 class ExportData(grok.Permission): 129 144 """The ExportData permission allows to export any kind of portal data. … … 131 146 grok.name('waeup.exportData') 132 147 148 133 149 class ExportPaymentsOverview(grok.Permission): 134 150 grok.name('waeup.exportPaymentsOverview') 135 151 152 136 153 class ExportBursaryData(grok.Permission): 137 154 grok.name('waeup.exportBursaryData') 138 155 156 139 157 class ViewTranscript(grok.Permission): 140 158 grok.name('waeup.viewTranscript') 159 141 160 142 161 class ManagePortalConfiguration(grok.Permission): … … 146 165 grok.name('waeup.managePortalConfiguration') 147 166 167 148 168 class ManageACBatches(grok.Permission): 149 169 """The ManageACBatches permission allows to view and … … 152 172 grok.name('waeup.manageACBatches') 153 173 174 154 175 class PutBiometricDataPermission(grok.Permission): 155 176 """This permission allows to upload/change biometric data. … … 157 178 grok.name('waeup.putBiometricData') 158 179 180 159 181 class GetBiometricDataPermission(grok.Permission): 160 182 """This permission allows to read biometric data. … … 167 189 class ApplicationsManager(grok.Role): 168 190 """The local ApplicationsManager role can be assigned at applicants 169 container and at department level. At department level an Applications 170 Manager can manage all applicants which desire to study a programme 191 container and at department level. At department level an Applications 192 Manager can manage all applicants which desire to study a programme 171 193 offered by the department (1st Choice Course of Study). 172 194 173 At container level (local) Applications Managers gain permissions 174 which allow to manage the container and all applicants inside the container.175 At container level the permission set of this local role corresonds with176 thepermission set of the same-named global role.195 At container level (local) Applications Managers gain permissions which 196 allow to manage the container and all applicants inside the container. At 197 container level the permission set of this local role corresonds with the 198 permission set of the same-named global role. 177 199 """ 178 200 grok.name('waeup.local.ApplicationsManager') … … 182 204 'waeup.payApplicant') 183 205 206 184 207 class DepartmentManager(grok.Role): 185 208 """The local DepartmentManager role can be assigned at faculty or … … 196 219 'waeup.exportData') 197 220 221 198 222 class DepartmentOfficer(grok.Role): 199 223 """The local DepartmentOfficer role can be assigned at faculty or … … 211 235 'waeup.exportPaymentsOverview') 212 236 237 213 238 class ClearanceOfficer(grok.Role): 214 239 """The local ClearanceOfficer role can be assigned at faculty or … … 227 252 'waeup.clearAllStudents') 228 253 254 229 255 class LocalStudentsManager(grok.Role): 230 256 """The local LocalStudentsManager role can be assigned at faculty or … … 242 268 'waeup.exportData') 243 269 270 244 271 class LocalWorkflowManager(grok.Role): 245 272 """The local LocalWorkflowManager role can be assigned at faculty level. … … 257 284 'waeup.exportData') 258 285 286 259 287 class UGClearanceOfficer(grok.Role): 260 288 """UG Clearance Officers are regular Clearance Officers with restricted … … 269 297 'waeup.clearAllStudents') 270 298 299 271 300 class PGClearanceOfficer(grok.Role): 272 301 """PG Clearance Officers are regular Clearance Officers with restricted … … 281 310 'waeup.clearAllStudents') 282 311 312 283 313 class CourseAdviser100(grok.Role): 284 314 """The local CourseAdviser100 role can be assigned at faculty, 285 department or certificate level. The role allows to view all data and 286 to list or export all student data within the faculty, department 315 department or certificate level. The role allows to view all data and 316 to list or export all student data within the faculty, department 287 317 or certificate the local role is assigned. 288 318 … … 297 327 'waeup.exportData') 298 328 329 299 330 class CourseAdviser200(grok.Role): 300 331 """Same as CourseAdviser100 but for level 200. … … 306 337 'waeup.exportData') 307 338 339 308 340 class CourseAdviser300(grok.Role): 309 341 """Same as CourseAdviser100 but for level 300. … … 315 347 'waeup.exportData') 316 348 349 317 350 class CourseAdviser400(grok.Role): 318 351 """Same as CourseAdviser100 but for level 400. … … 324 357 'waeup.exportData') 325 358 359 326 360 class CourseAdviser500(grok.Role): 327 361 """Same as CourseAdviser100 but for level 500. … … 333 367 'waeup.exportData') 334 368 369 335 370 class CourseAdviser600(grok.Role): 336 371 """Same as CourseAdviser100 but for level 600. … … 342 377 'waeup.exportData') 343 378 379 344 380 class CourseAdviser700(grok.Role): 345 381 """Same as CourseAdviser100 but for level 700. … … 351 387 'waeup.exportData') 352 388 389 353 390 class CourseAdviser800(grok.Role): 354 391 """Same as CourseAdviser100 but for level 800. … … 359 396 'waeup.viewAcademics', 360 397 'waeup.exportData') 398 361 399 362 400 class Lecturer(grok.Role): … … 372 410 'waeup.exportData') 373 411 412 374 413 class Owner(grok.Role): 375 414 """Each user 'owns' her/his user object and gains permission to edit … … 380 419 grok.permissions('waeup.editUser') 381 420 421 382 422 # Site Roles 383 384 423 class AcademicsOfficer(grok.Role): 385 424 """An Academics Officer can view but not edit data in the … … 393 432 grok.title(u'Academics Officer (view only)') 394 433 grok.permissions('waeup.viewAcademics') 434 395 435 396 436 class AcademicsManager(grok.Role): … … 405 445 'waeup.manageAcademics') 406 446 447 407 448 class ACManager(grok.Role): 408 449 """This is the role for Access Code Managers. … … 413 454 grok.title(u'Access Code Manager') 414 455 grok.permissions('waeup.manageACBatches') 456 415 457 416 458 class DataCenterManager(grok.Role): … … 424 466 grok.permissions('waeup.manageDataCenter') 425 467 468 426 469 class ImportManager(grok.Role): 427 470 """An Import Manager is a Data Center Manager who is also allowed 428 to batch process (import) data. All batch processors (importers) are 471 to batch process (import) data. All batch processors (importers) are 429 472 available except for the User Processor. This processor requires the 430 473 Users Manager role too. The ImportManager role includes the … … 436 479 'waeup.importData') 437 480 481 438 482 class ExportManager(grok.Role): 439 483 """An Export Manager is a Data Center Manager who is also allowed … … 446 490 'waeup.exportData') 447 491 492 448 493 class BursaryOfficer(grok.Role): 449 494 """Bursary Officers can export bursary data. They can't access the … … 455 500 'waeup.viewAcademics', 456 501 'waeup.exportBursaryData') 502 457 503 458 504 class UsersManager(grok.Role): … … 465 511 grok.permissions('waeup.manageUsers', 466 512 'waeup.editUser') 513 467 514 468 515 class WorkflowManager(grok.Role): … … 508 555 'waeup.viewTranscript', 509 556 'waeup.viewDocuments', 'waeup.manageDocuments', 510 'waeup.managePortalConfiguration', 'waeup.viewApplication', 557 'waeup.managePortalConfiguration', 558 'waeup.viewApplication', 511 559 'waeup.manageApplication', 'waeup.handleApplication', 512 560 'waeup.viewApplicantsTab', 'waeup.payApplicant', … … 514 562 'waeup.viewStudent', 'waeup.manageStudent', 515 563 'waeup.clearStudent', 'waeup.payStudent', 516 'waeup.clearStudentFinancially', # not used in base p ackage564 'waeup.clearStudentFinancially', # not used in base pkg 517 565 'waeup.uploadStudentFile', 'waeup.showStudents', 518 566 'waeup.clearAllStudents', … … 530 578 ) 531 579 580 532 581 class CCOfficer(grok.Role): 533 582 """The role of the Computer Center Officer is basically a copy … … 545 594 grok.name('waeup.CCOfficer') 546 595 grok.title(u'Computer Center Officer') 547 grok.permissions(#'waeup.managePortal', 548 #'waeup.manageUsers', 549 'waeup.viewAcademics', 'waeup.manageAcademics', 550 #'waeup.manageACBatches', 551 'waeup.manageDataCenter', 552 #'waeup.importData', 553 'waeup.exportData', 554 'waeup.viewTranscript', 555 'waeup.viewDocuments', 'waeup.manageDocuments', 556 'waeup.managePortalConfiguration', 'waeup.viewApplication', 557 'waeup.manageApplication', 'waeup.handleApplication', 558 'waeup.viewApplicantsTab', 'waeup.payApplicant', 559 'waeup.viewApplicationStatistics', 560 'waeup.viewStudent', 'waeup.manageStudent', 561 'waeup.clearStudent', 'waeup.payStudent', 562 'waeup.uploadStudentFile', 'waeup.showStudents', 563 'waeup.clearAllStudents', 564 'waeup.editScores', 565 #'waeup.triggerTransition', 566 'waeup.validateStudent', 567 'waeup.viewStudentsContainer', 568 'waeup.handleAccommodation', 569 'waeup.viewHostels', 'waeup.manageHostels', 570 #'waeup.editUser', 571 #'waeup.loginAsStudent', 572 'waeup.handleReports', 573 'waeup.manageReports', 574 #'waeup.manageJobs', 575 ) 596 grok.permissions( 597 # 'waeup.managePortal', 598 # 'waeup.manageUsers', 599 'waeup.viewAcademics', 600 'waeup.manageAcademics', 601 # 'waeup.manageACBatches', 602 'waeup.manageDataCenter', 603 # 'waeup.importData', 604 'waeup.exportData', 605 'waeup.viewTranscript', 606 'waeup.viewDocuments', 'waeup.manageDocuments', 607 'waeup.managePortalConfiguration', 'waeup.viewApplication', 608 'waeup.manageApplication', 'waeup.handleApplication', 609 'waeup.viewApplicantsTab', 'waeup.payApplicant', 610 'waeup.viewApplicationStatistics', 611 'waeup.viewStudent', 'waeup.manageStudent', 612 'waeup.clearStudent', 'waeup.payStudent', 613 'waeup.uploadStudentFile', 'waeup.showStudents', 614 'waeup.clearAllStudents', 615 'waeup.editScores', 616 # 'waeup.triggerTransition', 617 'waeup.validateStudent', 618 'waeup.viewStudentsContainer', 619 'waeup.handleAccommodation', 620 'waeup.viewHostels', 'waeup.manageHostels', 621 # 'waeup.editUser', 622 # 'waeup.loginAsStudent', 623 'waeup.handleReports', 624 'waeup.manageReports', 625 # 'waeup.manageJobs', 626 ) 627 576 628 577 629 def get_all_roles(): … … 579 631 """ 580 632 return getUtilitiesFor(IRole) 633 581 634 582 635 def get_waeup_roles(also_local=False): … … 601 654 yield item 602 655 656 603 657 def get_waeup_role_names(): 604 658 """Get the ids of all Kofa roles. … … 609 663 """ 610 664 return sorted([x.id for x in get_waeup_roles()]) 665 611 666 612 667 class LocalRolesAssignable(grok.Adapter): … … 654 709 return sorted(list_of_dict, key=lambda x: x['name']) 655 710 711 656 712 def get_all_users(): 657 713 """Get a list of dictionaries. … … 660 716 for key, val in users: 661 717 yield(dict(name=key, val=val)) 718 662 719 663 720 def get_users_with_local_roles(context): … … 674 731 raise StopIteration 675 732 for local_role, user_name, setting in role_map.getPrincipalsAndRoles(): 676 user = grok.getSite()['users'].get(user_name, None)733 user = grok.getSite()['users'].get(user_name, None) 677 734 user_title = getattr(user, 'title', user_name) 678 735 local_role_title = getattr( 679 736 dict(get_all_roles()).get(local_role, None), 'title', None) 680 yield dict(user_name = user_name, 681 user_title = user_title, 682 local_role = local_role, 683 local_role_title = local_role_title, 684 setting = setting) 737 yield dict(user_name=user_name, 738 user_title=user_title, 739 local_role=local_role, 740 local_role_title=local_role_title, 741 setting=setting) 742 685 743 686 744 def get_users_with_role(role, context): … … 694 752 raise StopIteration 695 753 for user_name, setting in role_map.getPrincipalsForRole(role): 696 user = grok.getSite()['users'].get(user_name, None)754 user = grok.getSite()['users'].get(user_name, None) 697 755 user_title = getattr(user, 'title', user_name) 698 756 user_email = getattr(user, 'email', None) 699 yield dict(user_name =user_name,700 user_title =user_title,701 user_email =user_email,702 setting =setting)757 yield dict(user_name=user_name, 758 user_title=user_title, 759 user_email=user_email, 760 setting=setting)
Note: See TracChangeset for help on using the changeset viewer.