Global

Members

logger :Object

Allows server-side code to log messages to the application's log with different severities (TRACE, INFO, WARN, ERROR).
*** Does not increase your server-side API call count (unless you are LoggingToDatabase) ***
Type:
  • Object
Source:

Methods

addReferenceToObj(ffUrl, refName, obj)

Explicitly add a FatFractal 'reference to another object' to this object. For example, addReferenceToObj(user.ffUrl, "ffUser", profile) will add a reference to the 'user' object to the 'profile' object.
*** Does not increase your server-side API call count ***
NB: This function does NOT persist this object. You will need to call updateObj
Parameters:
Name Type Description
ffUrl String the referenced object's ffUrl
refName String the name we are giving to this reference relationship
obj Object the object to which we are adding the reference
Source:

bypassCache(f) → {Function}

Available from release 1.3.0
For paid subscriptions, there are always at least two instances of your app's backend running.
NoServer instances cache some recently-used data. In normal circumstances the cache in one instance of your app will be invalidated by changes in another instance, within 1-5 milliseconds. However sometimes you just need to be CERTAIN that you are hitting the data store directly.
For example if a user of your app has just made an in-app purchase, and immediately makes a subsequent request to retrieve data which should only be accessible following that purchase, then you will want to be absolutely sure that the second request (which may go to a different instance of your app's backend) will accurately reflect the data.
Parameters:
Name Type Description
f Function
Source:
Returns:
Type
Function
Example
var obj = ff.bypassCache(ff.getObjFromUri) ("/FFUser/anonymous");

createObjAtUri(obj, relativeUrl, asUserGuid) → {ObjectWithMetadata}

A CRUD CREATE method that will attempt to create a new resource on the your apps backend at the relativeUrl location. Returns the object, or null in the event of a failure.
Parameters:
Name Type Argument Description
obj Object The instance of any arbitrary class object to be created and persisted on the your apps backend.
relativeUrl String is the url for this resource relative to your applications base HREF.
asUserGuid String <optional>
Defaults to 'system'. The operation is executed as if it were this user, so all security access controls will be in effect.
Source:
Returns:
the returned object from the your apps backend.
Type
ObjectWithMetadata
Example
 createdMyStuff = ff.createObjAtUrl(myStuff, "/Furniture");

deleteAllForQuery(query, asUserGuid) → {Number}

Delete all objects which match the query
Parameters:
Name Type Argument Description
query String
asUserGuid String <optional>
Defaults to 'system'. The operation is executed as if it were this user, so all security access controls will be in effect.
Source:
See:
Returns:
the number of objects which were deleted
Type
Number
Example
// delete all objects in /Celebrity where firstName == 'Adam'
ff.deleteAllForQuery("/Celebrity/(firstName eq 'Adam')");
// delete all objects in /Celebrity
ff.deleteAllForQuery("/Celebrity");

deleteObj(obj, asUserGuid)

A CRUD DELETE method that will attempt to delete an existing resource from the your apps backend.The object must have previously been retrieved or created via the FF API.
Parameters:
Name Type Description
obj object The instance of any arbitrary class object to be deleted from the your apps backend.
asUserGuid String Defaults to 'system'. The operation is executed as if it were this user, so all security access controls will be in effect.
Source:
Example
 ff.deleteObj(currentTopCeleb);

deleteObjAtUri(ffUrl, asUserGuid)

A CRUD DELETE method that will attempt to delete an existing resource from the your apps backend when passed in the url location for the object.The object must have previously been retrieved or created via the FF API.
Parameters:
Name Type Argument Description
ffUrl String The ffUrl of the object to be deleted from the your apps backend.
asUserGuid String <optional>
Defaults to 'system'. The operation is executed as if it were this user, so all security access controls will be in effect.
Source:
Example
ff.deleteObjAtUrl("/Celebrity/" + data.pickedGuid);

executeDepthQuery(base, depthRef, depthGb, asUserGuid) → {Object}

A server-side function allowing the equivalent of the client-side queries using depthRef and depthGb parameters - see http://fatfractal.com/docs/queries/#retrieving-related-objects-inline
Parameters:
Name Type Argument Description
base Array the list of objects for which you want to run a depth query
depthRef see http://fatfractal.com/docs/queries/#retrieving-related-objects-inline
depthGb see http://fatfractal.com/docs/queries/#retrieving-related-objects-inline
asUserGuid String <optional>
Defaults to 'system'. The operation is executed as if it were this user, so all security access controls will be in effect.
Source:
Returns:
with two keys: 'references' - being an array of all referred objects 'grabBagItems' - being a map (keyed by ffUrl) of maps (keyed by grab-bag name) of arrays of ffUrls
Type
Object
Example
// For example in a server extension
var guidParam = ff.getExtensionRequestData().httpParameters['guid'];
var objs = ff.getArrayFromUri("/Collection/" + guidParam);
var depthResponse = ff.executeDepthQuery(objs, 2, 2, 'system');
ff.response().wrap = false; // Must have this - otherwise result will look like {statusMessage:null,result:{statusMessage:'Doing...',result:...,references:...,grabBagItems:...}}
ff.response().result = {
    statusMessage:'Doing depth queries on the server side',
    result:objs,
    references:depthResponse.references,
    grabBagItems:depthResponse.grabBagItems
};

executeFFDL(ffdl) → {String}

Execute some FFDL. Can supply multiple commands if they are separated by newlines. Will throw an exception if something goes wrong (eg incorrect syntax).
*** Does not increase your server-side API call count ***
Parameters:
Name Type Description
ffdl String The FFDL to execute
Source:
Returns:
[] any errors encountered
Type
String

filterObjectsWithFFRQL(objs, queryFrag)


*** Does not increase your server-side API call count ***
Parameters:
Name Type Description
objs Array
queryFrag String
Source:

getActiveUser() → {FFUser}

Gets the currently 'active' user.
*** Does not increase your server-side API call count ***
For server extensions, this means the logged-in user (or the 'anonymous' user if the user isn't logged in)
For event handlers, this will be the logged-in user,
or, if the event was triggered by server-side invocation of a CRUD function,
then the active user will be the user identified by the 'asUserGuid' parameter
Note: When you invoke CRUD functions server-side, if you omit the 'asUserGuid' parameter then it defaults to the 'system' user.
Source:
Returns:
Type
FFUser

getAllGuids(requestUri, asUserGuid) → {String[]}

A CRUD READ method that will attempt to retrieve 0..N resources from the your apps backend. Returns an Array containing all of the guids for the objects of that type at that resource location.
Parameters:
Name Type Argument Description
requestUri String (required) is the url for this query.
asUserGuid String <optional>
Defaults to 'system'. The operation is executed as if it were this user, so all security access controls will be in effect.
Source:
Returns:
An array that contains all the guids for the objects of that type at that resource location.
Type
String[]
Example
 totalRatings = ff.getAllGuids("/WouldYa");

getAppMetaData() → {*}

Gets the same (almost) app metadata as that which is returned when you make a call to /ff/metadata from the web.
*** Does not increase your server-side API call count ***
NB: Unlike the call from the web, this server-side function will return all PRIVATE SETtings as well as the public ones
Source:
Returns:
Type
*

getArrayFromUri(requestUri, asUserGuid) → {ObjectWithMetadata[]}

A CRUD READ method that will attempt to retrieve 0..N resources from the your apps backend. Returns an Array containing all of the objects of that type at that resource location.
Parameters:
Name Type Argument Description
requestUri String (required) is the url for this query. For example @"/ff/resources/MyObjects/(foo eq 'fooValue')"
asUserGuid String <optional>
Defaults to 'system'. The operation is executed as if it were this user, so all security access controls will be in effect.
Source:
Returns:
An array that contains all objects of that type at that resource location.
Type
ObjectWithMetadata[]
Example
 yourRatings = ff.getArrayFromUri("/WouldYa/(createdBy eq '" + createdBy + "')");

getBlob(blobName, obj, asUserGuid) → {Binary}

Get a BLOB member for an object.
Parameters:
Name Type Argument Description
blobName String the member name of the BLOB
obj Object the object
asUserGuid String <optional>
Defaults to 'system'. The operation is executed as if it were this user, so all security access controls will be in effect.
Source:
Returns:
the BLOB
Type
Binary
Example
var userProfile = ...    // object with blob member "imageData"
getBlob("imageData", userProfile);

getCursorForQuery(query, asUserGuid) → {KeyValueCursor}

Return a cursor allowing iteration through the set of objects which match the query
Parameters:
Name Type Argument Description
query String
asUserGuid String <optional>
Defaults to 'system'. The operation is executed as if it were this user, so all security access controls will be in effect.
Source:
See:
Returns:
Type
KeyValueCursor
Example
var cursor = ff.getCursorForQuery("/Celebrity/(firstName eq 'Adam')");
while (cursor.hasNext()) {
  var keyValuePair = cursor.next();
  var key = keyValuePair.key;
  var obj = keyValuePair.value;
  // do stuff
}

getEventHandlerData()

Get object data from within an event handler. NOTE: When the event is an UPDATE event, this function will return the data for the NEW version of the object.
Please use getUpdateEventHandlerData() if you need both the OLD and the NEW versions of the object for UPDATE events.
*** Does not increase your server-side API call count ***
Source:
See:
Returns:
event handler object data and metadata
Example
var data = ff.getEventHandlerData();
print("object created at " + data.createdAt + " by " + data.createdBy");

getExtensionRequestData() → {ExtensionRequestData}

Get request data from within a server extension
*** Does not increase your server-side API call count ***
Source:
See:
Returns:
extension request data, with the following fields:
  • httpMethod: the HTTP method (eg. GET, POST, PUT, DELETE, HEAD)
  • httpRequestUri: the request URI, relative to your application’s base URL
  • httpParameters: A map of the request parameters
  • httpHeaders: A map of the request headers
  • httpCookies: For convenience, a map of the cookies from the Cookie request header
  • httpContent: A map corresponding to the JSON content supplied in the request body, if any
  • ffUser: the guid of the logged-in user.
Type
ExtensionRequestData

getFfdlSetting(paramName) → {String}

Get a SETting (whether defaulted, or as set in application.ffdl)
*** Does not increase your server-side API call count ***
Parameters:
Name Type Description
paramName
Source:
Returns:
- null if no value has been set
Type
String

getGroup(groupGuid, asUserGuid) → {FFUserGroup}

Utility method to get an FFUserGroup from the datastore.
Parameters:
Name Type Description
groupGuid string the guid of the FFUserGroup we want to retrieve
asUserGuid String Defaults to 'system'. The operation is executed as if it were this user, so all security access controls will be in effect.
Source:
Returns:
the group
Type
FFUserGroup

getGuids(resourceLocation, count, asUserGuid) → {String[]}

A CRUD READ method that will attempt to up to a given number of guids from a specified location.
Parameters:
Name Type Argument Description
resourceLocation String uri of the desired resources
count Number maximum number of guids to return
asUserGuid String <optional>
Defaults to 'system'. The operation is executed as if it were this user, so all security access controls will be in effect.
Source:
Returns:
guids
Type
String[]

getHttpAppAddress() → {string}

Get the HTTP address of the application
*** Does not increase your server-side API call count ***
Source:
Returns:
HTTP address
Type
string

getHttpRequestData() → {HttpRequestData}

Get HTTP request data (if any) from within any server-side code
*** Does not increase your server-side API call count ***
Source:
Returns:
extension request data, with the following fields:
  • httpMethod: the HTTP method (eg. GET, POST, PUT, DELETE, HEAD)
  • httpRequestUri: the request URI, relative to your application’s base URL
  • httpParameters: A map of the request parameters
  • httpHeaders: A map of the request headers
  • httpCookies: For convenience, a map of the cookies from the Cookie request header
Type
HttpRequestData

getHttpsAppAddress() → {string}

Get the HTTPS address of the application
*** Does not increase your server-side API call count ***
Source:
Returns:
HTTPS address
Type
string

getObjFromUri(ffUrl, asUserGuid) → {ObjectWithMetadata}

A CRUD READ method that will attempt to retrieve a single resource from this relative URL.
Parameters:
Name Type Argument Description
ffUrl String (required) is the url for this resource relative to the #baseUrl property set above.
asUserGuid String <optional>
Defaults to 'system'. The operation is executed as if it were this user, so all security access controls will be in effect.
Source:
Returns:
the returned object from the your apps backend.
Type
ObjectWithMetadata
Example
 readMyStuff = ff.getObjFromUri(myStuffUri);

getPermission(ffUrl, asUserGuid) → {ACL}

Get the current explicitly-set permissions for this object, if any.
Parameters:
Name Type Argument Description
ffUrl String the ffUrl of the object
asUserGuid String <optional>
Defaults to 'system'. The operation is executed as if it were this user, so all security access controls will be in effect.
Source:
Returns:
Type
ACL

getReferredObject(refName, obj, asUserGuid)

Get a referred object
Parameters:
Name Type Description
refName String the name of the reference relationship
obj Object the referring object
asUserGuid String Defaults to 'system'. The operation is executed as if it were this user, so all security access controls will be in effect.
Source:

getRefUrl(obj, refName) → {*}

Utility method to get the ffUrl of a referred object
Parameters:
Name Type Description
obj
refName
Source:
Returns:
Type
*

getResultCountForQuery(query, asUserGuid) → {Number}

Returns the number of objects which match this query.
Note: This will return extremely quickly when executed as the system user. However when executed as a different user,
the security access controls are exercised - this requires that all objects are retrieved from the database and then filtered via security
For queries which return very large numbers of objects, this is necessarily a couple of orders of magnitude slower.
Parameters:
Name Type Argument Description
query String
asUserGuid String <optional>
Defaults to 'system'. The operation is executed as if it were this user, so all security access controls will be in effect.
Source:
See:
Returns:
Type
Number
Example
var query = "/Celebrity/(firstName eq 'Adam')";
var count = ff.getResultCountForQuery(query);
print ("Query " + query + " returns " + count + " objects");

getUpdateEventHandlerData()

Gets the object data for both the OLD and NEW versions of the object, for UPDATE events.
*** Does not increase your server-side API call count ***
Source:
See:
Throws:
an error if this function is called when the event was not an UPDATE event
Type
Object
Returns:
an object like this: {old:{<old data>},new:{<new data>}}

getUser(userGuid, asUserGuid) → {FFUser}

Utility method to get an FFUser from the datastore.
Parameters:
Name Type Argument Description
userGuid String the guid of the FFUser we want to retrieve
asUserGuid String <optional>
Defaults to 'system'. The operation is executed as if it were this user, so all security access controls will be in effect.
Source:
Returns:
the user
Type
FFUser

grabBagAdd(itemUrl, parentUrl, grabBagName, asUserGuid)

Add an item to the object's named grab bag.
Parameters:
Name Type Argument Description
itemUrl String The ffUrl of the item which is to be added
parentUrl String The ffUrl of the object whose grab bag is going to be updated
grabBagName String The grab bag name
asUserGuid String <optional>
Defaults to 'system'. The operation is executed as if it were this user, so all security access controls will be in effect.
Source:
Example
 grabBagAdd(anOrderLine.ffUrl, anOrder.ffUrl, "OrderLines");

grabBagCountObjects(parentUrl, grabBagName, asUserGuid) → {Number}

Get number of items in the object's named grab bag
Parameters:
Name Type Argument Description
parentUrl String The ffUrl of the object from whose grab bag we are retrieving
grabBagName String The grab bag name
asUserGuid String <optional>
Defaults to 'system'. The operation is executed as if it were this user, so all security access controls will be in effect.
Source:
Returns:
The number of objects in the specified grab bag
Type
Number

grabBagGetAll(parentUrl, grabBagName, asUserGuid) → {Array}

Get all items from the object's named grab bag
Parameters:
Name Type Description
parentUrl The ffUrl of the object from whose grab bag we are retrieving
grabBagName The grab bag name
asUserGuid String Defaults to 'system'. The operation is executed as if it were this user, so all security access controls will be in effect.
Source:
Returns:
All objects from specified grab bag
Type
Array
Example
 var grabBagContents = grabBagGetAll(anOrder.ffUrl, "OrderLines");

grabBagGetAllForQuery(parentUrl, grabBagName, query, asUserGuid) → {Array}

Get items, via query, from the object's named grab bag
Parameters:
Name Type Description
parentUrl The ffUrl of the object from whose grab bag we are retrieving
grabBagName The grab bag name
query The query string in FatFractal Query Language format
asUserGuid String Defaults to 'system'. The operation is executed as if it were this user, so all security access controls will be in effect.
Source:
Returns:
Objects from specified grab bag matching query
Type
Array
Example
 var results = grabBagGetAllForQuery(anOrder.ffUrl, "OrderLines", "(orderLineValue gt 1000)");

grabBagRemove(itemUrl, parentUrl, grabBagName, asUserGuid)

Remove an item from the object's named grab bag.
For example, grabBagRemove(anOrderLine.ffUrl, anOrder.ffUrl, "OrderLines")
Parameters:
Name Type Description
itemUrl String The ffUrl of the item which is to be removed
parentUrl String The ffUrl of the object whose grab bag is going to be updated
grabBagName String The grab bag name
asUserGuid String Defaults to 'system'. The operation is executed as if it were this user, so all security access controls will be in effect.
Source:

lockMutex(mutexName, timeoutInSeconds) → {Boolean}

Attempt to acquire an application-wide mutex lock.
Parameters:
Name Type Description
mutexName String for example, the ffUrl of an object you want to lock for some reason
timeoutInSeconds Number mutex will be auto-unlocked after this many seconds (in the event that for some reason unlockMutex isn't called by your code)
Source:
Returns:
true if locked, false otherwise
Type
Boolean

realTimePublish(topicName, payload)

publish messages which are delivered in real-time via web-sockets to subscribing clients.
NB: Currently in alpha testing - please contact us if you wish to join the alpha trial
Parameters:
Name Type Description
topicName String a topic name - alphanumeric characters only
payload String generic payload - most usefully, a JSON string, but can be any string
Source:

refChanged(oldObj, newObj, refName) → {boolean}

Utility method to see if a reference has changed between two versions of the same object - very useful in UPDATE event handlers
Parameters:
Name Type Description
oldObj
newObj
refName
Source:
Returns:
Type
boolean
Example
 // Let's say you have an event handler for UPDATE on an object where you want to detect if the blob has changed
 exports.blobUpdateTestEventHandler = function() {
     var data = ff.getUpdateEventHandlerData();
     var oldObj = data['old'];
     var newObj = data['new'];

     var refName = 'testBlob';
     if (refChanged(oldObj, newObj, refName)) {
        // Do something useful
     }
 };

registerUser(user, password, active, fireEvents) → {FFUser}

Register a new user. Note that this first version only registers LOCAL users - i.e. not Twitter, Facebook etc
The next major release will really open up the registration / authentication mechanisms giving developers much more control
Parameters:
Name Type Description
user Object An object with (at least) the following keys:
userName, firstName, lastName, email
password String the initial password
active Boolean defines whether or not the user will be 'active' i.e. able to do anything other than login and retrieve data
fireEvents Boolean defines whether or not to fire /FFUser Create events (and thus have any defined event handlers execute)
Source:
Returns:
the newly created user
Type
FFUser

removeReferenceFromObj(refName, obj)

Remove the FatFractal 'reference to another object' with the name 'refName' from this object.
*** Does not increase your server-side API call count ***
NB: This function does NOT persist this object. You will need to call updateObj
Parameters:
Name Type Description
refName String the name of the reference relationship
obj Object the object from which to remove the reference
Source:

resetPassword(userGuid, password)

Force a password change for this user.
Parameters:
Name Type Description
userGuid String the guid of the user whose password is being changed
password String the new password
Source:

response() → {ExtensionResponse}

Returns a handle to the response object which your extension's code needs to populate in order for data to be returned from your extension.
*** Does not increase your server-side API call count ***
Source:
See:
Returns:
response object containing the following fields: responseCode, statusMessage, result, mimeType
Type
ExtensionResponse
Example
var r = ff.response();
r.responseCode = 200;
r.statusMessage = "All is well";

saveBlob(obj, blobName, blob, mimeType, asUserGuid) → {ObjectWithMetadata}

Save a BLOB.
Parameters:
Name Type Argument Description
obj Object the object whose member this blob is
blobName String the member name of the BLOB
blob Binary the binary data itself
mimeType String the mime type of the BLOB
asUserGuid String <optional>
Defaults to 'system'. The operation is executed as if it were this user, so all security access controls will be in effect.
Source:
Returns:
the updated object (version, updatedAt, ffRefs and possibly updatedBy will all have changed)
Type
ObjectWithMetadata
Example
var blobPng = ...
saveBlob(userProfile, "imageData", blobPng, "image/png");

sendEmail(data)

Improved email-sending function; capable of sending HTML email. Future enhancements to this method will enable sending of attachments (for example, BLOBs from the FatFractal data store).
Parameters:
Name Type Description
data Object an object with the following fields:
{String} host The SMTP host
{String} port The SMTP port
{String} auth Whether authorization is required ("true" or "false")
{String} authPort The SMTP port for authorization
{String} username The SMTP username
{String} password The SMTP password
{String} from The sendMail from email address.
{String} fromName The display name of the sender
{String} to The sendMail to email address.
{String} cc The sendMail cc email address (optional).
{String} bcc The sendMail bcc email address (optional).
{String} subject The sendMail subject.
{String} text Plain text content - MUST be supplied, so that a plain text version of the email can always be sent
{String} html HTML content - optional
Source:

sendIOSPush(notificationToken, certFileName, certPassword, sendSynchronously)

Parameters:
Name Type Argument Description
notificationToken String The iOS Notification token - eg <a1a1a1a1 b2b2b2b2 c3c3c3c3 d4d4d4d4 e5e5e5e5 f6f6f6f6 a2a2a2a2 b3b3b3b3>
payload. Object eg:
    {
        "aps" : {
            "alert" : {
                "body" : "Bob wants to play poker",
                "action-loc-key" : "PLAY"
            },
            "badge" : 5
        },
        "acme1" : "bar",
        "acme2" : [ "bang",  "whiz" ]
    }
certFileName String <optional>
if not set, will ultimately default to "/resources/ApplePushKeystore.p12"
certPassword String <optional>
if not set, will ultimately default to the value set in application.ffdl for "ApplePushKeystorePassword"
sendSynchronously Boolean <optional>
defaults to false. Whether to send this message synchronously or queue for delivery asynchronously. WARNING: Synchronous sending is for TESTING purposes only; you should never use synchronous sending in production
Source:

sendPushNotifications(userGuids, message, sendSynchronously)

The sendPushNotifications method allows any server-side code to send Push Notifications programatically.
Parameters:
Name Type Description
userGuids String[] An array of userGuid sendPushNotifications will send to.
message Object The message to send in the Push Notifications. Message should be either:
  {ios:{IOS_CONTENT}}
    or
  {gcm:{GCM_CONTENT}}
    or
  {ios:{IOS_CONTENT},gcm:{GCM_CONTENT}}

where IOS_CONTENT is content as per "Examples of JSON payloads" in the iOS push notification guide

and GCM_CONTENT is content as per the HTTP Message Parameters in the GCM guidelines here http://developer.android.com/google/gcm/server.html

Note that in the gcm message, the FatFractal backend takes care of adding in the array of registration_ids

sendSynchronously Boolean Whether to send this message synchronously or queue for delivery asynchronously. WARNING: Synchronous sending is for TESTING purposes only; you should never use synchronous sending in production
Source:
Example
 
 r = ff.sendPushNotifications (ff.getActiveUser().guid, {
      ios:{
        "aps" : {
          "alert" : {
            "body" : "Bob wants to play poker",
            "action-loc-key" : "PLAY"
          },
          "badge" : 5
        },
        "acme1" : "bar",
        "acme2" : [ "bang",  "whiz" ]
      },
      gcm:{
        "collapse_key": "score_update",
        "time_to_live": 108,
        "delay_while_idle": true,
        "data": {
          "score": "4 x 8",
          "time": "15:16.2342"
        }
      }
    }, false);
 

sendSMTPEmail(host, port, auth, authPort, username, password, fromAddress, toAddress, subject, body)

This function has been deprecated. Please use sendEmail instead.
The sendSMTPMail method allows any Event Handler or Server Extension to send an email programatically.
Parameters:
Name Type Description
host string The SMTP host
port string The SMTP port
auth string Whether authorization is required (true or false)
authPort string The SMTP port for authorization
username string The SMTP username
password string The SMTP password
fromAddress string The sendMail from email address.
toAddress string The sendMail to email address.
subject string The sendMail subject.
body string The sendMail body.
Deprecated:
  • Yes
Source:
See:
Example
 ff.sendSMTPEmail("smtp.gmail.com", "465", "true", "465", "YourUserName", "YourPassword",
 "Your email address", "Recipient email address", "Hello, World!", "Hello from FatFractal")

setBypassCache(b)

Available from release 1.3.0
Parameters:
Name Type Description
b
Source:

setDefaultPermissionOnObject(ffUrl, asUserGuid) → {void}

Set the default permissions for this object. If object has a specific ACL, it is removed so that the defaults apply (PERMIT commands or, if there are no PERMIT commands, the overall system default (public can read, only creator can write)
Parameters:
Name Type Argument Description
ffUrl String the ffUrl of the object on which we are setting the permissions
asUserGuid String <optional>
Defaults to 'system'. The operation is executed as if it were this user, so all security access controls will be in effect.
Source:
Returns:
Type
void

setPermissionOnObject(ffUrl, readUsers, readGroups, writeUsers, writeGroups, asUserGuid) → {void}

Sets a specific ACL on an individual object
Parameters:
Name Type Argument Description
ffUrl String the ffUrl of the object on which we are setting the permissions
readUsers Array array of guids (or ffUrls) of the users who will be entitled to read the object
readGroups Array array of guids (or ffUrls) of the groups who will be entitled to read the object
writeUsers Array array of guids (or ffUrls) of the users who will be entitled to modify the object
writeGroups Array array of guids (or ffUrls) of the groups who will be entitled to modify the object
asUserGuid String <optional>
Defaults to 'system'. The operation is executed as if it were this user, so all security access controls will be in effect.
Source:
Returns:
Type
void

setTimeout(callback, timeoutInMillis, param)

Enables you to safely execute asynchronous code, server-side
Parameters:
Name Type Description
callback Function the function which will be executed after the timeout has expired
timeoutInMillis Number
param can be anything (object, array, function, ... )
Source:

signatureMatchesSignedData(base64PublicKey, signedData, signature) → {Boolean}

Parameters:
Name Type Description
base64PublicKey String the base64-encoded public key to use for verifying.
signedData String the signed JSON string - signed, not encrypted
signature String the signature for the data, signed with the private key
Source:
Returns:
true if supplied signature matches the signed data
Type
Boolean

unlockMutex(mutexName)

Remove an application-wide mutex. Should only ever be called by code which has previously successfully locked the mutex
Parameters:
Name Type Description
mutexName String for example, the ffUrl of an object you want to lock for some reason
Source:

updateObj(obj, asUserGuid) → {ObjectWithMetadata}

A CRUD UPDATE method that will attempt to update an existing resource on the your apps backend. The object must have previously been retrieved or created via the FF API.
Parameters:
Name Type Argument Description
obj Object The instance of any arbitrary class object to be created and persisted on
asUserGuid String <optional>
Defaults to 'system'. The operation is executed as if it were this user, so all security access controls will be in effect. the your apps backend.
Source:
Returns:
the returned object from the your apps backend.
Type
ObjectWithMetadata
Example
 newTopCeleb = ff.updateObj(currentTopCeleb);