Class KiiACL
Represents a KiiACL object
Defined in: KiiSDK.js.
Constructor Attributes | Constructor Name and Description |
---|---|
KiiACL()
|
Method Attributes | Method Name and Description |
---|---|
listACLEntries(callbacks)
Get the list of active ACLs associated with this object from the server
|
|
putACLEntry(entry)
Add a KiiACLEntry to the local object, if not already present.
|
|
removeACLEntry(entry)
Remove a KiiACLEntry to the local object.
|
|
save(callbacks)
Save the list of ACLEntry objects associated with this ACL object to the server
|
Method Detail
{Promise}
listACLEntries(callbacks)
Get the list of active ACLs associated with this object from the server
// example to use callbacks directly var acl = . . .; // a KiiACL object acl.listACLEntries({ success: function(theACL, theEntries) { // do something }, failure: function(theACL, anErrorString) { // do something with the error response } }); // example to use Promise var acl = . . .; // a KiiACL object acl.listACLEntries().then( function(params) { // fulfill callback function var theACL = params[0]; var theEntries = params[1]; // do something }, function(error) { // reject callback function var theACL = error.target; var anErrorString = error.message; // do something with the error response });
- Parameters:
- {Object} callbacks Optional
- An object with callback methods defined
- {Method} callbacks.success
- The callback method to call on a successful list request
- {Method} callbacks.failure
- The callback method to call on a failed list request
- Returns:
- {Promise} return promise object.
- fulfill callback function: function(params). params is Array instance.
- params[0] is the KiiACL instance which this method was called on.
- params[1] is array of KiiACLEntry instances.
- reject callback function: function(error). error is an Error instance.
- error.target is the KiiACL instance which this method was called on.
- error.message
- fulfill callback function: function(params). params is Array instance.
putACLEntry(entry)
Add a KiiACLEntry to the local object, if not already present. This does not explicitly grant any permissions, which should be done through the KiiACLEntry itself. This method simply adds the entry to the local ACL object so it can be saved to the server.
var aclEntry = . . .; // a KiiACLEntry object var acl = . . .; // a KiiACL object acl.putACLEntry(aclEntry);
- Parameters:
- {KiiACLEntry} entry
- The KiiACLEntry to add
- Throws:
- {InvalidArgumentException}
- If specified entry is not an instance of KiiACLEntry.
removeACLEntry(entry)
Remove a KiiACLEntry to the local object. This does not explicitly revoke any permissions, which should be done through the KiiACLEntry itself. This method simply removes the entry from the local ACL object and will not be saved to the server.
var aclEntry = . . .; // a KiiACLEntry object var acl = . . .; // a KiiACL object acl.removeACLEntry(aclEntry);
- Parameters:
- {KiiACLEntry} entry
- The KiiACLEntry to remove
- Throws:
- {InvalidArgumentException}
- If specified entry is not an instance of KiiACLEntry.
{Promise}
save(callbacks)
Save the list of ACLEntry objects associated with this ACL object to the server
// example to use callbacks directly var acl = . . .; // a KiiACL object acl.save({ success: function(theSavedACL) { // do something with the saved acl }, failure: function(theACL, anErrorString) { // do something with the error response } }); // example to use Promise var acl = . . .; // a KiiACL object acl.save().then( function(theSavedACL) { // fulfill callback function // do something with the saved acl }, function(error) { // reject callback function var theACL = error.target; var anErrorString = error.message; // do something with the error response });
- Parameters:
- {Object} callbacks Optional
- An object with callback methods defined
- {Method} callbacks.success
- The callback method to call on a successful save request
- {Method} callbacks.failure
- The callback method to call on a failed save request
- Returns:
- {Promise} return promise object.
- fulfill callback function: function(theSavedACL). theSavedACL is KiiACL instance.
- reject callback function: function(error). error is an Error instance.
- error.target is the KiiACL instance which this method was called on.
- error.message