Changes between Version 12 and Version 13 of S3/S3AAA/RecordApproval
- Timestamp:
- 06/13/14 12:03:48 (11 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
TabularUnified S3/S3AAA/RecordApproval
v12 v13 31 31 1) The Record Approval Framework can be turned '''on/off globally''' by a deployment setting: 32 32 33 {{{ 33 {{{#!python 34 34 settings.auth.record_approval = True 35 35 }}} … … 39 39 2) Whether record approval is required for a table can be configured '''per table''' like: 40 40 41 {{{ 41 {{{#!python 42 42 s3db.configure(tablename, requires_approval=True) 43 43 }}} … … 47 47 For a '''deployment-specific''' approval configuration, you can override all table-specific settings with: 48 48 49 {{{ 49 {{{#!python 50 50 settings.auth.record_approval_required_for = [tablename, tablename] 51 51 }}} … … 57 57 These permissions are encoded as auth.permission.REVIEW (permission to access unapproved records) and auth.permission.APPROVE (permission to approve or reject unapproved records). 58 58 59 {{{ 59 {{{#!python 60 60 acl = current.auth.permission 61 61 acl.update_acl(ROLE_XY, … … 77 77 S3Resource implements two low-level methods for record approval: 78 78 79 {{{ 79 {{{#!python 80 80 resource.approve() 81 81 }}} 82 82 ...to approve all records in a resource (and all its components), and 83 83 84 {{{ 84 {{{#!python 85 85 resource.reject() 86 86 }}} … … 88 88 89 89 '''Note:''' that S3Resource instances always exclude unapproved records, so these methods will always fail unless you define the resource with the unapproved=True parameter: 90 {{{ 90 {{{#!python 91 91 resource = current.s3db.resource("my_table", 1, unapproved=True) 92 92 }}} … … 108 108 == Callbacks == 109 109 For both, resource.approve() and resource.reject(), there are hooks which will be called for each record that gets approved/rejected: 110 {{{ 110 {{{#!python 111 111 s3db.configure(tablename, onapprove=function) 112 112 s3db.configure(tablename, onreject=function)