Changes between Version 12 and Version 13 of S3/S3AAA/RecordApproval


Ignore:
Timestamp:
06/13/14 12:03:48 (11 years ago)
Author:
MattS
Comment:

syntax highlighting

Legend:

Unmodified
Added
Removed
Modified
  • TabularUnified S3/S3AAA/RecordApproval

    v12 v13  
    31311) The Record Approval  Framework can be turned '''on/off globally''' by a deployment setting:
    3232
    33 {{{
     33{{{#!python
    3434settings.auth.record_approval = True
    3535}}}
     
    39392) Whether record approval is required for a table can be configured '''per table''' like:
    4040
    41 {{{
     41{{{#!python
    4242s3db.configure(tablename, requires_approval=True)
    4343}}}
     
    4747For a '''deployment-specific''' approval configuration, you can override all table-specific settings with:
    4848
    49 {{{
     49{{{#!python
    5050settings.auth.record_approval_required_for = [tablename, tablename]
    5151}}}
     
    5757These permissions are encoded as auth.permission.REVIEW (permission to access unapproved records) and auth.permission.APPROVE (permission to approve or reject unapproved records).
    5858
    59 {{{
     59{{{#!python
    6060            acl = current.auth.permission
    6161            acl.update_acl(ROLE_XY,
     
    7777S3Resource implements two low-level methods for record approval:
    7878
    79 {{{
     79{{{#!python
    8080resource.approve()
    8181}}}
    8282...to approve all records in a resource (and all its components), and
    8383
    84 {{{
     84{{{#!python
    8585resource.reject()
    8686}}}
     
    8888
    8989  '''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
    9191resource = current.s3db.resource("my_table", 1, unapproved=True)
    9292}}}
     
    108108== Callbacks ==
    109109For both, resource.approve() and resource.reject(), there are hooks which will be called for each record that gets approved/rejected:
    110 {{{
     110{{{#!python
    111111s3db.configure(tablename, onapprove=function)
    112112s3db.configure(tablename, onreject=function)