Auditor Roles

The enhanced version of Blockchain App Builder includes support for auditor roles when using the extended Token Taxonomy Framework standard.

The version of Blockchain App Builder supplied with Oracle Blockchain Platform Digital Assets Edition supports two additional roles for chaincode projects that use the extended Token Taxonomy Framework standard. The new roles are Token Auditor and Org Auditor. These roles function similarly to the Token Admin and Org Admin roles, but auditor roles are limited to read-only access. Admin roles have read-write access.

The following information describes the controller methods and SDK methods that support auditor roles in both TypeScript and Go.

TypeScript Controller Methods

The following controller methods support the auditor role functions.
addTokenAuditor
This method adds a user as a Token Auditor of the chaincode. This method can be called only by a Token Admin of the chaincode.
public async addTokenAuditor(org_id: string, user_id: string)
Parameters:
  • org_id: string – The membership service provider (MSP) ID of the user in the current organization.
  • user_id: string – The user name or email ID of the user.
Returns:
  • On success, a message that includes details of the user who was added as a Token Auditor of the chaincode.
Return Value Example:
{
    "returnCode": "Success",
    "error": "",
    "result": {
        "txid": "cd81f6c4c9e7c18ece357dbf5c139ef66ef2d6566be3b14de5f6d0a3fd4bb2f0",
        "payload": {
            "msg": "Successfully added Token Auditor (Org_Id: CB, User_Id: cb)"
        },
        "encode": "JSON",
        "sourceURL": "cb-oabcs1-bom.blockchain.ocp.example.com:20009",
        "blockNumber": 196
    }
}
removeTokenAuditor
This method removes a user as a Token Auditor of the chaincode. This method can be called only by a Token Admin of the chaincode.
public async removeTokenAuditor(org_id: string, user_id: string)
Parameters:
  • org_id: string – The membership service provider (MSP) ID of the user in the current organization.
  • user_id: string – The user name or email ID of the user.
Returns:
  • On success, a message that includes details of the user who was removed as a Token Auditor of the chaincode.
Return Value Example:
{
    "returnCode": "Success",
    "error": "",
    "result": {
        "txid": "a886a6040fbc76374a3c78c89ab0ffc9f7b8391cc5239b169bf3b878cf40c67b",
        "payload": {
            "msg": "Successfully removed Token Auditor (Org_Id: CB, User_Id: cb)"
        },
        "encode": "JSON",
        "sourceURL": "cb-oabcs1-bom.blockchain.ocp.example.com:20010",
        "blockNumber": 219
    }
}
getTokenAuditors
This method returns all Token Auditors of the chaincode. This method can be called only by a Token Admin or Token Auditor of the chaincode.
public async getTokenAuditors()
Return Value Example:
{
    "returnCode": "Success",
    "error": "",
    "result": {
        "payload": {
            "auditors": [
                {
                    "org_id": "CB",
                    "user_id": "auditor_user_cb"
                }
            ]
        },
        "encode": "JSON"
    }
}
addOrgAuditor
This method adds a user as a Org Auditor of the chaincode. This method can be called only by a Token Admin or Org Admin of the chaincode.
public async addOrgAuditor(org_id: string, user_id: string)
Parameters:
  • org_id: string – The membership service provider (MSP) ID of the user in the current organization.
  • user_id: string – The user name or email ID of the user.
Returns:
  • On success, a message that includes details of the user who was added as a Org Auditor of the chaincode.
Return Value Example:
{
    "returnCode": "Success",
    "error": "",
    "result": {
        "txid": "44bbad35a1478cb714e32f7cfd551897868a203520aab9cea5771d3aadc1cf03",
        "payload": {
            "msg": "Successfully added Org Auditor (Org_Id: CB, User_Id: cb)"
        },
        "encode": "JSON",
        "sourceURL": "cb-oabcs1-bom.blockchain.ocp.example.com:20009",
        "blockNumber": 198
    }
}
removeOrgAuditor
This method removes a user as a Org Auditor of the chaincode. This method can be called only by a Token Admin or Org Admin of the chaincode.
public async removeOrgAuditor(org_id: string, user_id: string)
Parameters:
  • org_id: string – The membership service provider (MSP) ID of the user in the current organization.
  • user_id: string – The user name or email ID of the user.
Returns:
  • On success, a message that includes details of the user who was removed as a Org Auditor of the chaincode.
Return Value Example:
{
    "returnCode": "Success",
    "error": "",
    "result": {
        "txid": "c3bc720461004a53b37c68d4bb264858b88d980bc093a0a3ebb62a32974fb306",
        "payload": {
            "msg": "Successfully removed Org Auditor (Org_Id: CB, User_Id: cb)"
        },
        "encode": "JSON",
        "sourceURL": "cb-oabcs1-bom.blockchain.ocp.example.com:20010",
        "blockNumber": 221
    }
}
getOrgAuditors
This method returns all Org Auditors of the chaincode. This method can be called only by a Token Admin, Token Auditor, Org Admin, or Org Auditor.
public async getOrgAuditors()
Return Value Example:
{
    "returnCode": "Success",
    "error": "",
    "result": {
        "payload": {
            "auditors": [
                {
                    "org_id": "FI1",
                    "user_id": "auditor_user_fi1"
                },
                {
                    "org_id": "FI2",
                    "user_id": "auditor_user_fi2"
                }
            ]
        },
        "encode": "JSON"
    }
}

Go Controller Methods

The following controller methods support the auditor role functions.
AddTokenAuditor
This method adds a user as a Token Auditor of the chaincode. This method can be called only by a Token Admin of the chaincode.
func (t *Controller) AddTokenAuditor(org_id string, user_id string) (interface{}, error)
Parameters:
  • org_id: string – The membership service provider (MSP) ID of the user in the current organization.
  • user_id: string – The user name or email ID of the user.
Returns:
  • On success, a message that includes details of the user who was added as a Token Auditor of the chaincode.
Return Value Example:
{
    "returnCode": "Success",
    "error": "",
    "result": {
        "txid": "f0888dd52f39dfa669275cc8f35d0b47b37b8407d384493d16970fcbb377f937",
        "payload": {
            "msg": "Successfully added Token Auditor (Org_Id: CB, User_Id: cb)"
        },
        "encode": "JSON",
        "sourceURL": "cb-oabcs1-bom.blockchain.ocp.example.com:20010",
        "blockNumber": 268
    }
}
RemoveTokenAuditor
This method removes a user as a Token Auditor of the chaincode. This method can be called only by a Token Admin of the chaincode.
func (t *Controller) RemoveTokenAuditor(org_id string, user_id string) (interface{}, error)
Parameters:
  • org_id: string – The membership service provider (MSP) ID of the user in the current organization.
  • user_id: string – The user name or email ID of the user.
Returns:
  • On success, a message that includes details of the user who was removed as a Token Auditor of the chaincode.
Return Value Example:
{
    "returnCode": "Success",
    "error": "",
    "result": {
        "txid": "2f01f48eceaf2dff175f98b96a5bdd22c949f48fc5683ce86d6141cc4892aee3",
        "payload": {
            "msg": "Successfully removed Token Auditor (Org_Id: CB, User_Id: cb)"
        },
        "encode": "JSON",
        "sourceURL": "cb-oabcs1-bom.blockchain.ocp.example.com:20010",
        "blockNumber": 270
    }
}
GetTokenAuditors
This method returns all Token Auditors of the chaincode. This method can be called only by a Token Admin or Token Auditor of the chaincode.
func (t *Controller) GetTokenAuditors() (interface{}, error)
Return Value Example:
{
    "returnCode": "Success",
    "error": "",
    "result": {
        "txid": "18eaa81b04d43db64f28287bab1cf6609e2a1d8ff84852ff73849ddb9a9dfba1",
        "payload": {
            "auditors": [
                {
                    "OrgId": "CB",
                    "UserId": "auditor_user_cb"
                }
            ]
        },
        "encode": "JSON",
        "sourceURL": "cb-oabcs1-bom.blockchain.ocp.example.com:20010",
        "blockNumber": 269
    }
}
AddOrgAuditor
This method adds a user as a Org Auditor of the chaincode. This method can be called only by a Token Admin or Org Admin of the chaincode.
func (t *Controller) AddOrgAuditor(org_id string, user_id string) (interface{}, error)
Parameters:
  • org_id: string – The membership service provider (MSP) ID of the user in the current organization.
  • user_id: string – The user name or email ID of the user.
Returns:
  • On success, a message that includes details of the user who was added as a Org Auditor of the chaincode.
Return Value Example:
{
    "returnCode": "Success",
    "error": "",
    "result": {
        "txid": "3d5ec46003c68c6208d43c82894bd6da5c0b763339cc5212e09b71d39d0d80e2",
        "payload": {
            "msg": "Successfully added Org Auditor (Org_Id: CB, User_Id: cb)"
        },
        "encode": "JSON",
        "sourceURL": "cb-oabcs1-bom.blockchain.ocp.example.com:20010",
        "blockNumber": 271
    }
}
RemoveOrgAuditor
This method removes a user as a Org Auditor of the chaincode. This method can be called only by a Token Admin or Org Admin of the chaincode.
func (t *Controller) RemoveOrgAuditor(org_id string, user_id string) (interface{}, error)
Parameters:
  • org_id: string – The membership service provider (MSP) ID of the user in the current organization.
  • user_id: string – The user name or email ID of the user.
Returns:
  • On success, a message that includes details of the user who was removed as a Org Auditor of the chaincode.
Return Value Example:
{
    "returnCode": "Success",
    "error": "",
    "result": {
        "txid": "713a120641afbc4dfaeac73b82c9fd51df6fcfd7d4d9a82553d3c487bf11f530",
        "payload": {
            "msg": "Successfully removed Org Auditor (Org_Id: CB, User_Id: cb)"
        },
        "encode": "JSON",
        "sourceURL": "cb-oabcs1-bom.blockchain.ocp.example.com:20010",
        "blockNumber": 273
    }
}
GetOrgAuditors
This method returns all Org Auditors of the chaincode. This method can be called only by a Token Admin, Token Auditor, Org Admin, or Org Auditor.
func (t *Controller) GetOrgAuditors() (interface{}, error)
Return Value Example:
{
    "returnCode": "Success",
    "error": "",
    "result": {
        "txid": "07656bf434616d7a3d7fe4fb81dc80c8cc608991648adfd9f6f2f2b9f6ddf468",
        "payload": {
            "auditors": [
                {
                    "OrgId": "CB",
                    "UserId": "cb"
                },
                {
                    "OrgId": "CB",
                    "UserId": "issuer_user_cb"
                }
            ]
        },
        "encode": "JSON",
        "sourceURL": "cb-oabcs1-bom.blockchain.ocp.example.com:20010",
        "blockNumber": 272
    }
}

TypeScript SDK Methods

The following SDK methods support the auditor role functions.
addTokenAuditor
This method adds a user as a Token Auditor of the chaincode.
this.Ctx.Admin.addTokenAuditor(org_id, user_id)
Parameters:
  • org_id: string – The membership service provider (MSP) ID of the user in the current organization.
  • user_id: string – The user name or email ID of the user.
Returns:
  • On success, a message that includes details of the user who was added as a Token Auditor of the chaincode.
Return Value Example:
{
    "returnCode": "Success",
    "error": "",
    "result": {
        "txid": "cd81f6c4c9e7c18ece357dbf5c139ef66ef2d6566be3b14de5f6d0a3fd4bb2f0",
        "payload": {
            "msg": "Successfully added Token Auditor (Org_Id: CB, User_Id: cb)"
        },
        "encode": "JSON",
        "sourceURL": "cb-oabcs1-bom.blockchain.ocp.example.com:20009",
        "blockNumber": 196
    }
}
removeTokenAuditor
This method removes a user as a Token Auditor of the chaincode.
this.Ctx.Admin.removeTokenAuditor(org_id, user_id)
Parameters:
  • org_id: string – The membership service provider (MSP) ID of the user in the current organization.
  • user_id: string – The user name or email ID of the user.
Returns:
  • On success, a message that includes details of the user who was removed as a Token Auditor of the chaincode.
Return Value Example:
{
    "returnCode": "Success",
    "error": "",
    "result": {
        "txid": "a886a6040fbc76374a3c78c89ab0ffc9f7b8391cc5239b169bf3b878cf40c67b",
        "payload": {
            "msg": "Successfully removed Token Auditor (Org_Id: CB, User_Id: cb)"
        },
        "encode": "JSON",
        "sourceURL": "cb-oabcs1-bom.blockchain.ocp.example.com:20010",
        "blockNumber": 219
    }
}
getTokenAuditors
This method returns all Token Auditors of the chaincode.
this.Ctx.Admin.getAllTokenAuditors()
Return Value Example:
{
    "returnCode": "Success",
    "error": "",
    "result": {
        "payload": {
            "auditors": [
                {
                    "org_id": "CB",
                    "user_id": "auditor_user_cb"
                }
            ]
        },
        "encode": "JSON"
    }
}
addOrgAuditor
This method adds a user as a Org Auditor of the chaincode.
this.Ctx.Admin.addOrgAuditor(org_id, user_id)
Parameters:
  • org_id: string – The membership service provider (MSP) ID of the user in the current organization.
  • user_id: string – The user name or email ID of the user.
Returns:
  • On success, a message that includes details of the user who was added as a Org Auditor of the chaincode.
Return Value Example:
{
    "returnCode": "Success",
    "error": "",
    "result": {
        "txid": "44bbad35a1478cb714e32f7cfd551897868a203520aab9cea5771d3aadc1cf03",
        "payload": {
            "msg": "Successfully added Org Auditor (Org_Id: CB, User_Id: cb)"
        },
        "encode": "JSON",
        "sourceURL": "cb-oabcs1-bom.blockchain.ocp.example.com:20009",
        "blockNumber": 198
    }
}
removeOrgAuditor
This method removes a user as a Org Auditor of the chaincode.
this.Ctx.Admin.removeOrgAuditor(org_id, user_id)
Parameters:
  • org_id: string – The membership service provider (MSP) ID of the user in the current organization.
  • user_id: string – The user name or email ID of the user.
Returns:
  • On success, a message that includes details of the user who was removed as a Org Auditor of the chaincode.
Return Value Example:
{
    "returnCode": "Success",
    "error": "",
    "result": {
        "txid": "c3bc720461004a53b37c68d4bb264858b88d980bc093a0a3ebb62a32974fb306",
        "payload": {
            "msg": "Successfully removed Org Auditor (Org_Id: CB, User_Id: cb)"
        },
        "encode": "JSON",
        "sourceURL": "cb-oabcs1-bom.blockchain.ocp.example.com:20010",
        "blockNumber": 221
    }
}
getOrgAuditors
This method returns all Org Auditors of the chaincode.
this.Ctx.Admin.getAllOrgAuditors()
Return Value Example:
{
    "returnCode": "Success",
    "error": "",
    "result": {
        "payload": {
            "auditors": [
                {
                    "org_id": "FI1",
                    "user_id": "auditor_user_fi1"
                },
                {
                    "org_id": "FI2",
                    "user_id": "auditor_user_fi2"
                }
            ]
        },
        "encode": "JSON"
    }
}

Go SDK Methods

The following controller methods support the auditor role functions.
AddTokenAuditor
This method adds a user as a Token Auditor of the chaincode.
t.Ctx.Admin.AddTokenAuditor(org_id, user_id)
Parameters:
  • org_id: string – The membership service provider (MSP) ID of the user in the current organization.
  • user_id: string – The user name or email ID of the user.
Returns:
  • On success, a message that includes details of the user who was added as a Token Auditor of the chaincode.
Return Value Example:
{
    "returnCode": "Success",
    "error": "",
    "result": {
        "txid": "f0888dd52f39dfa669275cc8f35d0b47b37b8407d384493d16970fcbb377f937",
        "payload": {
            "msg": "Successfully added Token Auditor (Org_Id: CB, User_Id: cb)"
        },
        "encode": "JSON",
        "sourceURL": "cb-oabcs1-bom.blockchain.ocp.example.com:20010",
        "blockNumber": 268
    }
}
RemoveTokenAuditor
This method removes a user as a Token Auditor of the chaincode.
t.Ctx.Admin.RemoveTokenAuditor(org_id, user_id)
Parameters:
  • org_id: string – The membership service provider (MSP) ID of the user in the current organization.
  • user_id: string – The user name or email ID of the user.
Returns:
  • On success, a message that includes details of the user who was removed as a Token Auditor of the chaincode.
Return Value Example:
{
    "returnCode": "Success",
    "error": "",
    "result": {
        "txid": "2f01f48eceaf2dff175f98b96a5bdd22c949f48fc5683ce86d6141cc4892aee3",
        "payload": {
            "msg": "Successfully removed Token Auditor (Org_Id: CB, User_Id: cb)"
        },
        "encode": "JSON",
        "sourceURL": "cb-oabcs1-bom.blockchain.ocp.example.com:20010",
        "blockNumber": 270
    }
}
GetTokenAuditors
This method returns all Token Auditors of the chaincode.
t.Ctx.Admin.GetAllTokenAuditors()
Return Value Example:
{
    "returnCode": "Success",
    "error": "",
    "result": {
        "txid": "18eaa81b04d43db64f28287bab1cf6609e2a1d8ff84852ff73849ddb9a9dfba1",
        "payload": {
            "auditors": [
                {
                    "OrgId": "CB",
                    "UserId": "auditor_user_cb"
                }
            ]
        },
        "encode": "JSON",
        "sourceURL": "cb-oabcs1-bom.blockchain.ocp.example.com:20010",
        "blockNumber": 269
    }
}
AddOrgAuditor
This method adds a user as a Org Auditor of the chaincode.
t.Ctx.Admin.AddOrgAuditor(org_id, user_id)
Parameters:
  • org_id: string – The membership service provider (MSP) ID of the user in the current organization.
  • user_id: string – The user name or email ID of the user.
Returns:
  • On success, a message that includes details of the user who was added as a Org Auditor of the chaincode.
Return Value Example:
{
    "returnCode": "Success",
    "error": "",
    "result": {
        "txid": "3d5ec46003c68c6208d43c82894bd6da5c0b763339cc5212e09b71d39d0d80e2",
        "payload": {
            "msg": "Successfully added Org Auditor (Org_Id: CB, User_Id: cb)"
        },
        "encode": "JSON",
        "sourceURL": "cb-oabcs1-bom.blockchain.ocp.example.com:20010",
        "blockNumber": 271
    }
}
RemoveOrgAuditor
This method removes a user as a Org Auditor of the chaincode.
t.Ctx.Admin.RemoveOrgAuditor(org_id, user_id)
Parameters:
  • org_id: string – The membership service provider (MSP) ID of the user in the current organization.
  • user_id: string – The user name or email ID of the user.
Returns:
  • On success, a message that includes details of the user who was removed as a Org Auditor of the chaincode.
Return Value Example:
{
    "returnCode": "Success",
    "error": "",
    "result": {
        "txid": "713a120641afbc4dfaeac73b82c9fd51df6fcfd7d4d9a82553d3c487bf11f530",
        "payload": {
            "msg": "Successfully removed Org Auditor (Org_Id: CB, User_Id: cb)"
        },
        "encode": "JSON",
        "sourceURL": "cb-oabcs1-bom.blockchain.ocp.example.com:20010",
        "blockNumber": 273
    }
}
GetOrgAuditors
This method returns all Org Auditors of the chaincode.
t.Ctx.Admin.GetAllOrgAuditors()
Return Value Example:
{
    "returnCode": "Success",
    "error": "",
    "result": {
        "txid": "07656bf434616d7a3d7fe4fb81dc80c8cc608991648adfd9f6f2f2b9f6ddf468",
        "payload": {
            "auditors": [
                {
                    "OrgId": "CB",
                    "UserId": "cb"
                },
                {
                    "OrgId": "CB",
                    "UserId": "issuer_user_cb"
                }
            ]
        },
        "encode": "JSON",
        "sourceURL": "cb-oabcs1-bom.blockchain.ocp.example.com:20010",
        "blockNumber": 272
    }
}