SmartFunctions are the engine for setting permissions in Fluree. This section details the role of smart functions.
To see a full list of all accepted smart functions, see smart function list.
We also have a Github repo with basic smart functions you can add to your applications.
For some additional help testing and debugging your smart function implementations, try updating your
logback.xml configuration file (located in your Fluree directory) so that logging for
fluree.db is set to
<logger name="fluree.db" level="DEBUG"/>
In this setting, Fluree will log the entirety of the Smart Function Stack, so that every time a query/transaction triggers the evaluation of a smart function, you can observe its invocation, context, and result.
Role of Smart Functions
Every time a transaction is issued, that transaction might trigger various smart functions. In addition, when an end user issues a query, various smart functions might be triggered.
Smart functions will either return
false. If every smart function that is triggered returns a
true, then the transaction will go through. If even one triggered smart function returns
false, then the transaction will fail, or in the case of a query- that piece of information will not be displayed to the user.
Smart functions are stored in the
_fn collection. From the
_fn collection, smart functions can be referenced in a variety of places. Functions stored in different locations are triggered in slightly different ways.
|_rule/fns||When an |
|_collection/spec||When transaction containing the specified |
|_predicate/spec||When transaction containing the specified |
|_predicate/txSpec||When transaction containing the specified |
|In transactions||You can use smart functions directly in transactions, but their role and behavior is slightly different.|