NxtFi
  • NxtFi Blockchain
  • Testing Network
  • Block Viewer
  • Playground
  • Authentication
  • Create New Block
  • Blockchain Libraries
    • NxtFi Tools
    • Javascript - CreateBlock
  • Smart Contracts
  • The Storage System
  • Upload Media Files
  • Blockchain API Interactions
  • Access Control Layer
    • How it Works
    • Syntax & Smart Contract requirements
    • Example
  • API - Listing Files
  • API Reference
    • Get node health
    • Get the last block
    • Get block information by hash
    • Get block information by timestamp
    • Get block information by height
    • Get files from storage by scope
    • Storage tracking interactions
    • Storage tracking timestamp block info
    • Submit new block
    • Presign media file upload
Powered by GitBook
On this page
  1. Access Control Layer

Syntax & Smart Contract requirements

How to get full advantage of the feature.

General syntax model:

  • // ACL commented line. (top code recommended)

  • var input = {}: Smart Contract object. Data structure where the requested metadata(headers, path, jwt, etc.) is stored.

  • if(ACL)=>{}statement, deploy conditions. This is the ACL-feature execution context, indeed.

  • throw excepted output.

This are the requirements to implement successfully the ACL feature. Let's dive a bit into them just to understand the context of their implementation.

"// ACL" comment: new instance of ACL execution is required.

var intput = {}; reserve memory location for self execution inputs.

if(ACL){

if (path[2] === "_storage"){

res= { private:"you have no perms to see this" };

sendResponse(res);

}else { <Smart-Contract-Logic> }

This statement is the place to deploy every case in which the ACL should throw anything special. for example: "this route should be private" or "this request should return directly data".

"Throw Exception" if custom actions are required otherwise will execute a normal API request.

PreviousHow it WorksNextExample

Last updated 1 year ago